A constructor is a member function of a class which initializes objects of a class. In C++, Constructor is automatically called when object(instance of class) create. It is special member function of the class.
constructor is different from normal functions in following ways:
Constructor has same name as the class itself
Constructors don’t have return type
A constructor is automatically called when an object is created.
If we do not specify a constructor, C++ compiler generates a default constructor for us (expects no parameters and has an empty body).
For more videos on C++, Subscribe my Youtube Channel
Subscribe: https://bit.ly/2Pc8wOX
Follow us on:
twitter: / learningbest1
instagram: / learningbest
Facebook: https://bit.ly/2Qjypc1