gamesmeister
asked on
Retrieving a Constant from a polymorphic object
Hi all,
I have a number of classes, each inheriting from an interface, and each with a matching const (i.e. the name of the const is the same, the value is different).
If I'm viewing an instance of one of these classes polymorphically via the interface, is there an easy way to access it's constant value? I could obviously add methods to each base class to return the const, but I wondered if there was any other, perhaps better, way of doing it?
Thanks
Gerry
I have a number of classes, each inheriting from an interface, and each with a matching const (i.e. the name of the const is the same, the value is different).
If I'm viewing an instance of one of these classes polymorphically via the interface, is there an easy way to access it's constant value? I could obviously add methods to each base class to return the const, but I wondered if there was any other, perhaps better, way of doing it?
Thanks
Gerry
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Off to update 30+ subclasses...
Thanks Alex