what is constructor in c++?
c++
Collapse
X
-
Tags: None
-
Originally posted by dhanyaspaiwhat is constructor in c++?
Raghuram -
If a class has a constructor defined, then whenever an instance of the class is created, the constructor would be automatically called. What the constructor does is to initialize the members of that class; according to how you have defined within the constructor itself.Comment
-
Constructor is also a function of a class but has the same name of that class. for example if you are creating a class let us call it as Test then the constructor is a function that has same name Test(arguments) ; this constructor will be called automatically when you are creating object for this class(Test).
Constructor and Destructor are very basic in C++. so i suggest you to study C++. you may get lot of free e-book for C++ if you search in Google.Comment
Comment