Automatic method overriding in sub-classes
Tofu Ninja via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 26 17:34:59 PDT 2015
On Tuesday, 27 October 2015 at 00:27:46 UTC, Tofu Ninja wrote:
> ...
crap, copy paste error
change the main to
void main()
{
A a = new A();
a.foo(); // prints nothing
a.bar(); // prints nothing
B b = new B();
b.foo(); // prints X
b.bar(); // prints X
A c = new B();
c.foo(); // prints nothing
c.bar(); // prints X, <--- main advantage
}
More information about the Digitalmars-d
mailing list