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.



Reply via email to