Skip to content

Instantly share code, notes, and snippets.

@tomprince
Created February 21, 2011 00:23
Show Gist options
  • Save tomprince/836465 to your computer and use it in GitHub Desktop.
Save tomprince/836465 to your computer and use it in GitHub Desktop.
#include <cstdio>
template <class T>
class B {
public:
virtual void do_stuff() { printf("B stuff.\n"); }
virtual ~B() { printf("~B stuff.\n"); }
};
template <class T>
class C : public B<T> {
public:
virtual void do_stuff() { printf("C stuff.\n"); }
virtual ~C() { printf("~C stuff.\n"); }
};
int main () {
B<int>* b = new C<int>();
b->do_stuff();
delete b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment