Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.40 KB | None | 0 0
  1. class Base(T)
  2. {
  3. public:
  4.     S add(S : T)(S child){return child;}
  5.     //void add(T){}
  6. }
  7.  
  8. class Foo
  9. {}
  10.  
  11. class Bar : public  Base!Bar
  12. {
  13. public:    
  14.     alias Base!Bar.add add;
  15.     void add(Foo f){}
  16. }
  17.  
  18.  
  19. void main()
  20. {
  21.     Bar b = new Bar();
  22.     Bar b2 = new Bar();
  23.     Foo f = new Foo();
  24.     b.add(f);
  25.     b.add(b2);
  26.     /*
  27.     main.d(14): Error: alias main.Bar.add conflicts with function main.Bar.add at main.d(15)
  28.     */
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement