C language What is a class constructor when is it executed a

C++ language
What is a class constructor, when is it executed, and what is it used for?

Explain the difference between the default and non-default constructor.

Solution

A class constructor is an instantiation of an object of type class. When an object of type class is created, the constructor will be executed. It is used to initalize the member variables of the class for that particular instance.

The difference between default constructor and the other kind of constructor is that, when no parameters are passed to the instance variable, the default constructor is called, where as, if parameters are passed to the instance variable the non-default constructor will be called.

C++ language What is a class constructor, when is it executed, and what is it used for? Explain the difference between the default and non-default constructor.S

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site