C++ Programming - Constructors and Destructors - Discussion
Discussion Forum : Constructors and Destructors - Programs (Q.No. 8)
8.
What will be the output of the following program?
#include<iostream.h>
class BixBase
{
public:
BixBase()
{
cout<< "Base OK. ";
}
};
class BixDerived: public BixBase
{
public:
BixDerived()
{
cout<< "Derived OK. ";
}
~BixDerived()
{
cout<< "Derived DEL. ";
}
};
int main()
{
BixBase objB;
BixDerived objD;
objD.~BixDerived();
return 0;
}
Discussion:
13 comments Page 2 of 2.
Bittooo said:
1 decade ago
Can we call destructor from main function? is it possible?
Shrey said:
1 decade ago
The answer is correct .I compiled in Dev c++;
Anil said:
1 decade ago
Why derived del is displayed 2 times ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers