fork(1) download
  1. import std.stdio;
  2.  
  3. MyClass mc;
  4.  
  5. void main()
  6. {
  7. mc = new MyClass();
  8. testClass tc = new testClass();
  9. tc.say();
  10. }
  11.  
  12. class MyClass
  13. {
  14.  
  15. string x = "dima";
  16. void say()
  17. {
  18. writeln("Say hello");
  19. }
  20.  
  21. }
  22.  
  23.  
  24. class testClass
  25. {
  26. void say()
  27. {
  28. .mc.say(); // почему мне могу вызвать не помещая в this ?
  29. }
  30.  
  31. }
Success #stdin #stdout 0s 2676KB
stdin
Standard input is empty
stdout
Say hello