O'Reilly logo

Sams Teach Yourself C++ in 21 Days , Fifth Edition by Bradley Jones, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Day 10. Working with Advanced Functions

On Day 5, “Organizing into Functions,” you learned the fundamentals of working with functions. Now that you know how pointers and references work, you can do more with functions.

Today, you will learn

• How to overload member functions

• How to overload operators

• How to write functions to support classes with dynamically allocated variables

Overloaded Member Functions

On Day 5, you learned how to implement function polymorphism, or function overloading, by writing two or more functions with the same name but with different parameters. Class member functions can be overloaded as well, in much the same way.

The Rectangle class, demonstrated in Listing 10.1, has two DrawShape() functions. One, which takes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required