C++ Class constructor overloading

Objectives :

  • myClassContrucOverload1.cpp
    // overloading constructor
    //myClassContrucOverload1.cpp
    // this is a series of two examples
    //here only default constructor will be engaged
  • This is a part of a series of documents continuing codes and snapshots of overloading class constructors and  member functions, side by side.
  • Code : myClassContrucOverload1.txt

Step: 1 Create a source file.

Step: 2 Edit and save Source file

a) Codes used in  Class module :

b) Defining and overloading the member methods

c) Codes in int main() function:

Step: 3 Runtime Views:

a) Note only default constructor responded, as we did not engage other constructors. When we create instance (object) of a class, default constructor, engaged. If we don't define a default constructor, the compiler will generate one for us.

Step: