Why is constructor used in C++?

In C++, constructor is a special method which is invoked automatically at the time of object creation. It is used to initialize the data members of new object generally . The constructor in C++ has the same name as class or structure.

Sizin İçin Seçtik  What happens when there is no default constructor?

Leave a Reply

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