Created
February 21, 2011 00:23
-
-
Save tomprince/836465 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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