class Drawable { public : virtual void draw() = 0; virtual ~Drawable() = 0; }; class MyDrawable : public Drawable { public : virtual void draw(); MyDrawable(); virtual ~MyDrawable(); private : int * data; }; MyDrawable::~MyDrawable() { delete data; } void MyDrawable::draw() { } MyDrawable::MyDrawable() { data = new int; } void del(Drawable* drawable) { delete drawable; } int main() { del(new MyDrawable()); }
class Drawable { public : virtual void draw() = 0; virtual ~Drawable() {}; }; class MyDrawable : public Drawable { public : virtual void draw(); MyDrawable(); virtual ~MyDrawable(); private : int * data; }; MyDrawable::~MyDrawable() { delete data; } void MyDrawable::draw() { } MyDrawable::MyDrawable() { data = new int; } void del(Drawable* drawable) { delete drawable; } int main() { del(new MyDrawable()); }
class Drawable { public : virtual void draw() = 0; virtual ~Drawable() = 0; }; Drawable::~Drawable() { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)