language: C++ 4.7.2 (gcc-4.7.2)
date: 667 days 22 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>
using namespace std;
 
struct Base
{
  virtual void foo () = 0;
  virtual ~Base() = 0;
};
Base::~Base() { cout<<"Base::~Base()\n"; }
struct Child : Base
{
  void foo() {}
  //ok! no destructor needed to create objects of 'Child'
};
 
int main ()
{
  Base *p = new Child;
  delete p;
}