On 02/22/2014 06:21 PM, luka8088 wrote:
import std.stdio;

class A {
   string x () { return "A"; };
}

class B : A {
   override string x () { return "B"; };
}

class C : A {
   string x = "C"; // should this be illegal?
}

void main () {
   A o1 = new B();
   writeln(o1.x); // B

   A o2 = new C();
   writeln(o2.x); // A
}

Just an addition. The following line shows the problem:
  writeln((cast(C)o2).x); // C

Reply via email to