Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.38 KB | None | 0 0
  1. import std.traits, std.stdio;
  2.  
  3. interface IFoo
  4. {
  5. }
  6.  
  7. mixin template genFoo(string name)
  8. {
  9.     mixin("class "~name~" : IFoo
  10.     {
  11.     }");
  12. }
  13.          
  14. mixin genFoo!("Foo");
  15.  
  16. void main()
  17. {
  18.     IFoo foo = new Foo;
  19.     Foo foo2 = new Foo;
  20.  
  21.     writeln(fullyQualifiedName!(typeof(foo)));
  22.     writeln(typeid(foo).name);
  23.     writeln(fullyQualifiedName!(typeof(foo2)));
  24.     writeln(typeid(foo2).name);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement