fork download
  1. import std.stdio;
  2.  
  3. abstract class Base {
  4. int i = 1;
  5. }
  6.  
  7. class Sub : Base {
  8. int i = 2;
  9. }
  10.  
  11. void main() {
  12. Sub s = new Sub;
  13. Base b = s;
  14.  
  15. writeln(s.i, " : ", &s.i);
  16. writeln(b.i, " : ", &b.i);
  17. }
Success #stdin #stdout 0.01s 2124KB
stdin
Standard input is empty
stdout
2 : B758BCCC
1 : B758BCC8