C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 17)
17.
Which of the following statement is correct?
A constructor is called at the time of declaration of an object.
A constructor is called at the time of use of an object.
A constructor is called at the time of declaration of a class.
A constructor is called at the time of use of a class.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
26 comments Page 2 of 3.

Shashikala.R said:   1 decade ago
How we can use copy constructors in real world problems?

Ruthrakarthik said:   1 decade ago
I think constructor will be called when object initialized.

Divya said:   1 decade ago
While creating an object, memory is allocated to that object when its constructor is invoked, it invokes only once during declaration of object, if you have not defined any constructor inside class then default constructor is invoked.

Payal Y. Makan said:   1 decade ago
A constructor is called whenever an object is created and declaration is nothing but creation of an object.

Vikrant Siwach said:   1 decade ago
A constructor is always called when an object is initialized, not declared and certainly not "used".

Suvi said:   1 decade ago
I think there one is the correct answer because in C++ declaring a object means its creation. :).

Narmadhasrinivasan said:   1 decade ago
Can you tell me whats the use of constructor?

Ashish Bardiya said:   1 decade ago
Constructor is call when an object is created or initialize. When we not write a code for constructor then compiler automatically added default constructor.

Farhana said:   1 decade ago
Constructor is a special member function of a class which is called/invoked when the object is created. It has the same name as that of a class.

Pradeep said:   1 decade ago
Because an constructor is called right when the object is created for a class.


Post your comments here:

Your comments will be displayed after verification.