Thought For The Day

“To expect the world to receive a new truth, or even an old truth, without challenging it, is to look for one of those
miracles which do not occur.”
Alfred Russel Wallace

 

 

Object-Oriented Programming: Operator Overloading - Increment/Decrement

Today's lesson is about overloading increment and decrement operators.  This might not seem like much, but in fact, these operators are going to be really interesting to overload.  Just to remind ourselves, increment (++) and decrement (--) operators have what we call "side effects": informally, a side effect is a result of an operator, expression, statement, or function that persists even after the operator, expression, statement, or function has finished being evaluated.  We also know that increment and decrement operators have two forms: prefix and postfix.  This fact is important in a sense that we will now have different ways of overloading these forms.

The prefix form of the increment/decrement operators is slightly easier to overload, so we'll start with that. (We will explain everything using the example of the increment operator, since overloading the decrement operator is completely analogous).

The increment operator is overloaded as a method - this is the first thing to remember.
Let's see the code:

Complex operator++()
{
    ++re; ++im;
    return *this;
}
The above method is pretty simple and self-explanatory.  It simply performs the increment, and returns the same object.  The postfix version is a little bit more tricky.  It is also overloaded as a method, but it has to have a single, "dummy" int parameter, for disambiguation purposes.
Complex operator++(int k)
{
    Complex w(re, im);
    re++; im++;
    return w;
}

As we can see, in the postfix version, first we make a copy of our object, which we later return.  This is due to the definition of this operator: first the value is returned, then the increment happens (the increment being a side effect in this case).  From the two implementations above, we can also notice possible differences in performance, as the postfix version performs an expensive copy operation.

Overloading increment and decrement operators is simple, but still very important, as they're among the most used ones.  In the next few articles we are going to talk about overloading some other groups of operators, so make sure you stay tuned!

Online example: http://cpp.sh/6stp

5 Creative Ways Businesses Are Using Instagram

Did you know that Instagram has over 300 million monthly users?  That’s more than Twitter!  Furthermore, Instagram users are shoppers.  A recent study reports that 70% of Instagram users have looked up a brand on the site’s platform, and 62% of users follow a brand just because they like it.  To take advantage of Instagram’s popularity, consider using it in one of the following creative ways:

  1. Show Your Product Being Made.  Document the manufacturing process with photos.  A lot of people find it very interesting to see how common, everyday products are created.  For instance, Oliver Winery used photos to show how its wine gets into bottles.

  2. Reward Posts.  The Picture House, a London diner, offers people free food if they take a photo of their meal and post it to Instagram with the hashtag #BirdsEyeInspirations; Birds Eye is the company behind the restaurant.  Other businesses can use this strategy by offering various promotions or discounts to people who post themselves using their product.

  3. Hold a Contest.  Contests can be an excellent way of generating brand excitement.  For example, Samsung Camera successfully used the hashtag #LiveInTheMoment to promote its Instagram photo contest on Facebook.

  4. Introduce Employees.  People really enjoy being able to view the faces behind a company.  Many businesses now introduce their employees to their Instagram followers with photos.  Not only do employees appreciate the hard-earned recognition, but this personal approach is popular with Instagram followers.

  5. Show Various Ways of Your Product Being Used.  If you have a product that can be used in a number of different ways—like baking soda—post various photos of your product’s versatility.  For example, Chobani realized that Instagram users were posting a number of different ways that its Greek yogurt had been used as a core ingredient in a recipe.  The company capitalized on that by similarly showing their product being used in atypical ways i.e. not just as a breakfast item but in appetizers, desserts, etc.  

4 Business Trends We’ll See in 2016

Now that the new year is upon us, what can businesses expect for 2016?  We’ve got the answer right here!  After sorting through expert opinions, we’ve identified the top business trends that are forecasted for this year:

  1. Growth of the Gig Economy.  More and more people are choosing to freelance.  While the number of people accepting gigs is expected to level off at some point, that is not predicted to occur in 2016.  This is great news for people seeking more freedom in their careers, as well as for businesses that want to retain high-quality talent for short-term assignments.

  2. Increased Job Automation.  As minimum wage and health care costs increase, companies are looking toward automation to remain competitive.  For instance, McDonald’s Europe already has touch screen ordering in place, eliminating the need for many of its workers.  As companies find innovative ways to automate customer service positions, this trend will continue to grow.

  3. Generation Z: The Next Big Marketing Push.  Step aside, millennials.  Marketers are starting to pay more attention to Generation Z, those born in the 1990s and mid-2000s.   Research indicates that this group is more entrepreneurially minded, tech savvy, and socially conscious.  Expect Generation Z to play a significant role in the way that businesses evolve their marketing strategies.

  4. Employees Demand Greater Flexibility.  According to Forbes, people work 47 hours a week on average and worse still, almost two-thirds of managers expect employees to be reachable when they’re on personal time.  While this type of dedication may be great for employers, more than half of workers are experiencing burnout.  For this reason, workplace flexibility will become increasingly important.  Companies that offer telecommuting, flexible work hours, and job sharing will be in a prime position to attract top talent, as more employees are placing a high premium on flexibility in the workplace.

Tackling the Dreaded Self-Appraisal

Nowadays, it’s not uncommon for employees to have to write their own performance reviews.  If you’ve ever stared at an empty performance review worksheet, you know how daunting this task can seem.  However, we have some tips that will not only make it easier to write but that will also highlight your successes in the best possible way:

  • Show, Don’t Tell.  Rather than saying, “I’m a great project manager,” think about specific examples you can use.  For instance, you might say, “When I ran the XYZ project, it was completed on time and under budget, saving the company $60,000.”

  • Remember the Entire Year.  Many people forget to include their accomplishments that took place in the earlier part of the year.  Spend some time in reflection so you don’t forget your career successes that occurred 6-12 months ago.

  • Discuss Areas for Improvement.  If you’ve made mistakes, acknowledge them carefully.  By carefully, we mean that you should put a positive spin on any errors by discussing what you learned from them and how that knowledge will improve your performance in the future.

  • Request Career Development Opportunities.  Is there a skill that you could improve upon with additional training?  Alternatively, is there some aspect of your job that really excites you that you’d like to spend more time doing?  Brainstorm ideas for developing your career in a way that will further your skillset while simultaneously igniting your passion.

  • Set Time Aside.  Because performance appraisals can be arduous to complete, many people breeze through them without investing a lot of effort.  Don’t be this person!  The appraisal will be used in part to determine what type of raise you get and as such, it is well worth the time that it takes to do a thorough job.  That said, it’s a good idea to complete your appraisal, think it over for a few days, and then return to it later to see if you still feel it is a good representation of your abilities.