Advertisement
Guest User

D-Lang issue.

a guest
Oct 20th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.43 KB | None | 0 0
  1. class Component
  2. {
  3.     public this(hash_t id)
  4.     {
  5.         this.id = id;
  6.     }
  7.  
  8.     public hash_t id;
  9. }
  10.  
  11. public class ComponentDetail(T) : Component
  12. {
  13.     public this()
  14.     {
  15.         super(ID);
  16.     }
  17.  
  18.     public static hash_t ID = typeid(T).toHash;
  19. }
  20.  
  21. public class AudioComponent : ComponentDetail!AudioComponent
  22. {
  23. }
  24.  
  25.  
  26.  
  27. int main()
  28. {
  29.     auto pComponent = new AudioComponent();
  30.     writeln(pComponent.getId());
  31.     writeln(AudioComponent.ID);
  32.     return -1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement