On 12.05.13 17.55, ardi wrote:
> I mean: how do you write a pure virtual getter if the return value has a different data type for each derived class?
>
> The getter for the 32 bit unsigned int will have a 32bit unsigned int as return value.
>
> The getter for the 32 bit float, will return a 32 bit float.
>
> How would I define both getters from a pure virtual getter? Is it possible?
No. But it makes no sense anyway. If any part of the application uses
the abstract base (without knowing about the actual implementation), it
cannot extract a value of an unknown type, because it simply cannot have
a target of the appropriate type.
It seems that you want to mix design time polymorphism (here templates)
with runtime polymorphism (virtual functions).
More details about what you intend to do with the abstract getters would
be helpful.
Marcel