C++ Programming - Constructors and Destructors - Discussion

Discussion :: Constructors and Destructors - General Questions (Q.No.5)

5. 

For automatic objects, constructors and destructors are called each time the objects

[A]. enter and leave scope
[B]. inherit parent class
[C]. are constructed
[D]. are destroyed

Answer: Option A

Explanation:

No answer description available for this question.

Sagar said: (Aug 20, 2012)  
What are automatic objects?

Nadim Ahmad said: (Sep 15, 2012)  
Really... What is automatic object...?

Nagnath Panchal said: (Sep 20, 2012)  
Please any one can explain me what are the automatic object ?

Kashish said: (Jun 13, 2013)  
What is automatic object?

Suneelkumar M said: (Jun 19, 2013)  
What are automatic objects?

Bhargavi said: (Jun 21, 2013)  
What is automatic object?

Normally we create classes then only object is created.

Diya said: (Aug 3, 2013)  
What is that automatic object?

Thatha said: (Aug 15, 2013)  
Jaffa old fox is meaning of automatic fox.

Jackode said: (Oct 6, 2013)  
I guess something like:

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

// use a here
}

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

Neha said: (Oct 24, 2013)  
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.

Goral said: (Jan 10, 2014)  
Please, give me answer 'what is automatic object?'.

Lilly said: (Mar 13, 2014)  
What is the mean of automatic object? then I feel it should create automatically at runtime according to the method. Thats write?

Vikrant said: (Jun 17, 2014)  
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.

Vikrant said: (Jun 17, 2014)  
Automatic object means Constructor can not need to called by using object.

Ganesh said: (Aug 20, 2014)  
That is correct automatic object means Constructor can not need to called by using object.

Viknesh said: (Aug 22, 2014)  
An automatic object is not a dummy argument. An automatic object always has the controlled automatic storage class.

Kanha said: (Nov 17, 2014)  
Automatic object is local object of any function like "this".

Shital Jawale said: (Mar 3, 2015)  
When object is created the constructor will automatically called.

Shital Jawale said: (Mar 3, 2015)  
When object is created the call goes automatically to the constructor.

Dhivya said: (Feb 2, 2016)  
I need clear answer with explanation.

Prabhas Sagar said: (Mar 1, 2016)  
What are automatic objects please explain in detailed?

Shyam Biradar said: (Mar 19, 2017)  
Automatic objects means local variables which are created in stackframe.

So now, you visualize what happens to local variables when a stack frame is created and when its destroyed.

Shree said: (Mar 24, 2018)  
Thanks for the explanation. It is very useful to understand the concept.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.