Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

c++ and destructors

Name: Anonymous 2006-11-17 15:51

Okay, take a peek at this code:
class A {};
class B:public A {
public:
  B() { /*stuff*/ }
  ~B() { /*stuff*/ }
};

Is this valid or do I have to declare an (empty) virtual destructor in class A? I _could_ make an app and test but that won't tell me if the result is defined or not.

Name: Anonymous 2006-11-17 17:10

>>1
Look, you're dead:
A *lolwhat = new B;
delete lolwhat; // you suck, ~A() is not virtual...

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List