Guest User

Untitled

a guest
May 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. struct Foo {
  2. template <typename T = Foo>
  3. static T *create() {
  4. return new T();
  5. }
  6. };
  7.  
  8. struct Bar : Foo {};
  9. struct Baz : Foo {};
  10.  
  11. int main() {
  12. Foo::create();
  13. Bar::create<Bar>();
  14. return 0;
  15. }
  16.  
  17. template <typename T = this_type>
Add Comment
Please, Sign In to add comment