A
ardi
Hi,
In order to automate the document management in my applications (or at least minimizing the coding effort), I'm planning to base the document design on an abstract class which has a pure virtual getter, a pure virtual setter,a pure virtual function for saving the item into a file, a pure virtual function for reading it from the file, as well as any other helpful functions(such as automatically flagging the document as "dirty" when the value has changed by calling the setter).
So, then I'd derive this abstract class into (for example) different classes for 16bit signed integers, 32bit unsigned integers, 32 bit floating point, 64 bit floating point, etc...
The pure virtual functions for file I/O are trivial, and have no secrets.
....but... the pure virtual accessors are a different matter...
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?
Thanks a lot for any suggestions, because this abstract data type class would ease a lot the coding effort in my applications!!
ardi
In order to automate the document management in my applications (or at least minimizing the coding effort), I'm planning to base the document design on an abstract class which has a pure virtual getter, a pure virtual setter,a pure virtual function for saving the item into a file, a pure virtual function for reading it from the file, as well as any other helpful functions(such as automatically flagging the document as "dirty" when the value has changed by calling the setter).
So, then I'd derive this abstract class into (for example) different classes for 16bit signed integers, 32bit unsigned integers, 32 bit floating point, 64 bit floating point, etc...
The pure virtual functions for file I/O are trivial, and have no secrets.
....but... the pure virtual accessors are a different matter...
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?
Thanks a lot for any suggestions, because this abstract data type class would ease a lot the coding effort in my applications!!
ardi