/******************************************************************************/
/* */
/* FILE: june.cpp */
/* */
/* Virtual methods follow special rules in destructors */
/* =================================================== */
/* */
/* Compiled and tested with Visual C++ V6.0 */
/* */
/* V1.00 30-JUN-2004 P. Tellenbach http://www.heimetli.ch/ */
/* */
/******************************************************************************/
#include <iostream>
using namespace std ;
class Base
{
protected:
virtual void print()
{
cout << " world !" << endl ;
}
public:
virtual ~Base()
{
print() ;
}
} ;
class Derived : public Base
{
protected:
virtual void print()
{
cout << "Hello" ;
}
public:
~Derived()
{
print() ;
}
} ;
int main( )
{
Derived d ;
return 0 ;
}
Update 30. June 2024
This program compiles and runs without any changes.