fork download
  1. import std.stdio;
  2.  
  3. class A {
  4. public:
  5. void print() { /*writeln( "a" );*/ }
  6. ~this() { b.print(); }
  7. B b;
  8. }
  9.  
  10. class B {
  11. public:
  12. void print() {/*writeln( "b" );*/ }
  13. ~this() { a.print(); }
  14. // A a;
  15. }
  16.  
  17.  
  18. int main( char[][] arg )
  19. {
  20. A a = new A();
  21. B b = new B();
  22. a.b = b;
  23. // b.a = a;
  24. return 0;
  25. }
  26.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.d(13): Error: undefined identifier a, did you mean class A?
prog.d(13): Error: undefined identifier a, did you mean class A?
prog.d(13): Error: no property 'print' for type 'int'
prog.d(13): Error: function expected before (), not __error of type int
stdout
Standard output is empty