Thank you for the explanation
On Thursday, 14 May 2015 at 19:00:16 UTC, tired_eyes wrote:
First, I don't understand why we see array[2] as 'Child'. While
it is a 'Child', shouldn't it be shown as a 'Parent' due to we
explicitly create an array of 'Parents'?
It is getting the name through a virtual interface (a hidden one
Hi.
I'm having a hard time understanding D's inheritance. Consider
the following code:
class Parent {
public int x = 10;
}
class Child : Parent {
public int y = 20;
}
void main() {
import std.stdio;
Parent[] array;
auto obj1 = new Parent();
auto obj2 = new Child();