What is constructor explain with example?

A constructor is a special type of member function that is called automatically when an object is created . In C++, a constructor has the same name as that of the class and it does not have a return type. For example, class Wall { public: // create a constructor Wall() { // code } };

Sizin İçin Seçtik  How much does a C++ Developer earn in India?

Leave a Reply

Your email address will not be published. Required fields are marked *