digitalmars.D - General OOP question
- Carotinho (13/13) Dec 07 2004 Hi!
- Sebastian Beschke (3/14) Dec 08 2004 -Sebastian
Hi! Since I'm a newbie even in OOP, I have a question which I think is quite general. If I declare a list of BaseType, and then insert in it a DerivedType derived from BaseType, when I need to access a member of DerivedType which I added, is it this the right syntax (cast(DerivedType)BaseType).NewMember; I worked this out by myself and it works right, but I wonder if there is some kind of problem using this syntax or what else. BTW, not related to this question, but associative arrays are very cool, so cool that I want to use them everywhere even when I don't need'em :) Thanks! Carotinho
Dec 07 2004
Carotinho wrote:Hi! Since I'm a newbie even in OOP, I have a question which I think is quite general. If I declare a list of BaseType, and then insert in it a DerivedType derived from BaseType, when I need to access a member of DerivedType which I added, is it this the right syntax (cast(DerivedType)BaseType).NewMember;Yep, that's it. :)I worked this out by myself and it works right, but I wonder if there is some kind of problem using this syntax or what else.-Sebastian
Dec 08 2004