Clunky syntax

ixid nuaccount at gmail.com
Mon May 7 10:52:00 PDT 2012


> class Foo {}
> class Bar : Foo {}
> void main() {
>    Foo b = new Bar;
> }

Thank you, could you explain what is happening in your example? 
Bar is inheriting from Foo, what are you getting when you create 
a parent of type sub-class compared  to Bar b = new Bar; and Foo 
b = new Foo; ? Foo b = new Bar won't compile if you add members 
to Bar and access them.





More information about the Digitalmars-d-learn mailing list