C++ Programming - Constructors and Destructors - Discussion
Discussion Forum : Constructors and Destructors - General Questions (Q.No. 34)
34.
Which of the following statements are correct?
Discussion:
9 comments Page 1 of 1.
Tan said:
3 years ago
Yes, you are right @Raonee.
Raonee said:
3 years ago
Constructor is always called implicitly whereas Destructor can be called either implicitly or explicitly both ways.
(1)
Arjun Mandavkar said:
4 years ago
@Rsadhu.
Constructor can only be called implicitly on objects. But destructor can be called implicitly or explicitly.
Constructor can only be called implicitly on objects. But destructor can be called implicitly or explicitly.
(1)
Shubham said:
6 years ago
The constructor can call implicitly but destructor can call implicitly as well implicitly.
Akshay said:
9 years ago
Java provides destructor implicitely.
Kartheek said:
9 years ago
Constructor and destructor both call implicitly and explicitly.
Rajan said:
9 years ago
Yes, you are right @Divya.
Divya said:
1 decade ago
Constructor as well as destructor both can be called implicitly and explicitly.
Rsadhu said:
1 decade ago
class T
{
public:
T(){}
~T(){}
};
int main(void)
{
T a;
T * b = new T;
delete b;
}
/*
a object's destructor is implicitly called when a goes out of scope.
b object's destructor is called explicitly when delete b is called.
*/
So I am not ready to accept this as an answer.
{
public:
T(){}
~T(){}
};
int main(void)
{
T a;
T * b = new T;
delete b;
}
/*
a object's destructor is implicitly called when a goes out of scope.
b object's destructor is called explicitly when delete b is called.
*/
So I am not ready to accept this as an answer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers