Retrieving a Constant from a polymorphic object
Posted on 2006-07-15
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?