We know that a class is more important than the objects it represents. The reason being that once a class is defined, any number of objects of the class type can be churned out at the run time of the program. We also know that the class is a set of specifications that are used by the compiler for the purpose of construction of objects.

In fact for the creation of an object, the compiler creates a function having the same name as the class itself as shown in Fig. 6.1. It may be noted that the name of the class is myClass and the name of the function created by the compiler is also myClass. This function is called as a constructor function. As the name suggests, the constructor function creates an ...

Get Object-Oriented Programming with C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.