C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - General Questions (Q.No. 5)
For automatic objects, constructors and destructors are called each time the objects
enter and leave scope
inherit parent class
are constructed
are destroyed
Answer: Option
No answer description is available. Let's discuss.
24 comments Page 2 of 3.

Vikrant said:   1 decade ago
Automatic object means Constructor can not need to called by using object.

Vikrant said:   1 decade ago
Constructor Special type of member function whose name same as class name constructor are automatically called when object is created and Enter in leave in scope.

Destructor are automatically called when object is Destroyed.

Lilly said:   1 decade ago
What is the mean of automatic object? then I feel it should create automatically at runtime according to the method. Thats write?

Goral said:   1 decade ago
Please, give me answer 'what is automatic object?'.

Neha said:   1 decade ago
It is said in Stroustrup
"An object constructed by explicit or implicit use of a constructor is automatic and will be destroyed at the first opportunity.".

So if I define a new object of any class using a new function.

Will it still be considered automatic and be deleted ?

or would it be saved in the heap such that it will be deleted only using delete
command ?

className objName = new(className); //this is what I have in mind.

Jackode said:   1 decade ago
I guess something like:

void function (){
class {...} a;

// use a here

a is automatic object that constructed and destructed in scope of function.

Thatha said:   1 decade ago
Jaffa old fox is meaning of automatic fox.

Diya said:   1 decade ago
What is that automatic object?

Bhargavi said:   1 decade ago
What is automatic object?

Normally we create classes then only object is created.

SuneelKumar M said:   1 decade ago
What are automatic objects?

Post your comments here:

Your comments will be displayed after verification.