Home » C++ Programming » Constructors and Destructors

What will be the output of the following program? #include class CuriousTabBase { public: CuriousTabBase() { cout<< "Base OK. "; } virtual ~CuriousTabBase() { cout<< "Base DEL. "; } }; class CuriousTabDerived: public CuriousTabBase { public: CuriousTabDerived() { cout<< "Derived OK. "; } ~CuriousTabDerived() { cout<< "Derived DEL. "; } }; int main() { CuriousTabBase *basePtr = new CuriousTabDerived(); delete basePtr; return 0; }

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!