I have a hierarchy such as:
Element
|_Resitance
|_DC Voltage Source
|_AC Voltage Source
|_AC Current Source
|_DC Current Source
|_DynamicElement
| |_Inductor
| |_Capacitor
|_SwitchingDevices
| |_Switch
| |_Diode
.
.
.
As my input can be any a list of those, they are all inserted in a std::vector<Element*>
. The problem is that Diode, Switch and the Voltage sources have a ID member that I have to access.
I want to be able to run a *(*Element).ID or something like this, when I'm sure that the Element is a subclass with such member.
I really don't want to include ID member in the Element class because this is something that is going to happen a lot an the class would have a lot of inappropriate member.