C++ Programming - Constructors and Destructors - Discussion
Discussion Forum : Constructors and Destructors - General Questions (Q.No. 5)
5.
For automatic objects, constructors and destructors are called each time the objects
Discussion:
24 comments Page 1 of 3.
Sagar said:
1 decade ago
What are automatic objects?
Nadim Ahmad said:
1 decade ago
Really... What is automatic object...?
Nagnath Panchal said:
1 decade ago
Please any one can explain me what are the automatic object ?
Kashish said:
10 years ago
What is automatic object?
SuneelKumar M said:
10 years ago
What are automatic objects?
Bhargavi said:
10 years ago
What is automatic object?
Normally we create classes then only object is created.
Normally we create classes then only object is created.
Diya said:
10 years ago
What is that automatic object?
Thatha said:
10 years ago
Jaffa old fox is meaning of automatic fox.
Jackode said:
9 years ago
I guess something like:
void function (){
class {...} a;
// use a here
}
a is automatic object that constructed and destructed in scope of function.
void function (){
class {...} a;
// use a here
}
a is automatic object that constructed and destructed in scope of function.
Neha said:
9 years 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.
"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.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers