I got surprised with the result. I thought instances of the super classes were always created before the child classes, but, based on the result, it seems that it is not what happen.
It's more like the not private members of the super class are included inside the child class, and you can use "super" and "this" more like a namespace ...
Leandro Coutinho wrote:I got surprised with the result. I thought instances of the super classes were always created before the child classes, but, based on the result, it seems that it is not what happen.
It's more like the not private members of the super class are included inside the child class, and you can use "super" and "this" more like a namespace ...
Well... yeah. That's how it works. When you create an instance (with the new operator), there is only one instance. Large inheritance trees don't generate lots of objects..... And the private members of the super class are included too.