A class can contain one of the three types of functions - accessor function, mutator function and manager function. Accessor function is member function that accesses contents of object but does not modify that object. It simply returns value of one of the member variables. Mutator function is also known as set methods. It is used to modify the value of an object. Manager functions are special member functions that have specific features to perform the task.

Constructor is a member method with the same name as its class. It is used to initialise the objects of that class type with legal initial values. The constructors are classified into two types – non-parameterised constructor and copy constructor. Non-parameterised constructor (default constructor) does not contain any arguments. To invoke default constructor, no arguments are passed to the constructor while creating the objects. Parameterised constructor contains arguments to assign the values to the class elements. To invoke parameterised constructor, values of arguments are passed to the constructor function while creating the objects. Constructor is a special type of function, which is required to create an object. Every time an object is created, the compiler will automatically initialise it by invoking the initialisation function. Constructor overloading is a way of defining two or more constructors with the same name and different signatures. The default constructor is defined with no arguments. The parameterised constructor is defined with two arguments. Copy constructor is used to declare and initialise the object from another object.

To Access the full content, Please Purchase