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.

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

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

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.

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.

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

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

Poonam said:   1 decade ago
Constructor is called as soon as the object is invoked.

Shrikant said:   1 decade ago
Because object needs to construct class elements and create real world object.

Bala Manikandan said:   1 decade ago
A constructor is called at the time of initialization of an object and not at declaration.

Naveen singh said:   1 decade ago
If constructor is not define in class, then it will be provided by JVM automatically.
(1)


Post your comments here:

Your comments will be displayed after verification.