Learn basic concept of c , c++ and python programming in regularcodes.com

Spread the post

constructors in cpp

Following characteristics are important to constructors in cpp.

1) Constructor are the member function of a class.
2) The name of constructor is must same as class name.
3) Constructor are not return any value that means constructors are no return type.
4) Parameterized constructor are possible.
5) Multiple constructor in a class are possible. that means there are possible to overload constructors.
6) By Explicitly and implicitly constructor calling are possible.
7) Constructor should be declared in the public section.
8) They are invoked automatically when object are created.
9) Constructor are not inherited. but derived class constructor to call Base class constructors.
10) constructor cannot be virtual.

Program for constructor in cpp.


Spread the post

Recommended Posts: