C++ Programming - Constructors and Destructors - Discussion
Discussion Forum : Constructors and Destructors - General Questions (Q.No. 3)
3.
Can a class have virtual destructor?
Discussion:
22 comments Page 2 of 3.
ABC said:
1 decade ago
What is the meaning of explicitly call?
Krunal said:
1 decade ago
No.
Because compiler does not provide any default constructor when we provided explicitly.
Because compiler does not provide any default constructor when we provided explicitly.
Sai said:
1 decade ago
Can constructors be virtual?
Lilly said:
1 decade ago
Please clarify my doubt. Class is declared as virtual then how the class contain destructor?
Velmurugan said:
1 decade ago
Destructor is invisibility in your program and it's call automatically. Because every constructor program using inside destructor.
KJS said:
1 decade ago
In C++ there is no automatic garbage collection.
Priyanka said:
1 decade ago
But if object goes out of scope, destructor is called automatically. Then why we need to call it explicitly?
Dwarika said:
1 decade ago
Destructor can be virtual because whenever the object goes in out of the scope then we have to delete it explicitly.
Nishant Singh said:
1 decade ago
Virtual functions provide run time polymorphism as the function to be executed is decided at run-time.
Surya.T said:
1 decade ago
What is mean by virtual function?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers