I was playing around with struct and realised that when i inherit from a base-class, i can no longer initialise the inherited struct the way i'm used to.
Here's how i initialise:
I use Borland free compiler 5.5. And the error i get is:
Any idea? It's probably not possible to initialise derived structures like that? Nat.
Code:
struct Date{[indent]int dd, mm, yy;[/indent]
}
struct Employee{[indent]char* fname, *lname;
Date hiring_d;
short dept;
[/indent]
};
struct Manager : public Employee{[indent]short level; //i've tried commenting this line for furher testing but no luck[/indent]
};
Code:
int main()
{[indent]
Employee e1 = {"Snoop", "Dogg", ' ', {25,3,2008}, 101}; //this is ok
Manager m1 = {"Gin", "Juice", '& ', {01,01,2000}, 101, 2}; //this fails
[/indent]
}
Error E2190 Ch12DerivedClas s.cpp 43: Unexpected }
Any idea? It's probably not possible to initialise derived structures like that? Nat.
Comment