Advertisement
Guest User

Untitled

a guest
Jan 7th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.42 KB | None | 0 0
  1. // outputs:
  2. // float
  3. // string
  4.  
  5. import std.stdio;
  6.  
  7. class Test
  8. {
  9.     public @property float opDispatch(string s)()
  10.         if (s.length == 1)
  11.     {
  12.         return 5.5;
  13.     }
  14.  
  15.     public @property string opDispatch(string s)()
  16.         if (s.length != 1)
  17.     {
  18.         return "hello";
  19.     }
  20. }
  21.  
  22. void main()
  23. {
  24.     Test test = new Test;
  25.     writeln(typeof(test.x).stringof);
  26.     writeln(typeof(test.xy).stringof);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement