Hi there!
I'm currently stuck in creating a data structure with dynamic amount and types of data members/variables.
To be more specific - the target device I'm developping for, is the Palm PDA, so I have to look for memory efficient ways of implementation.
I created a table which views editable user data of different types. However, this table's columns can be changed, so the data structure of a table row should be able to change, too.
Currently the structure is fixed, so depending on the table layout configuration, a couple of data members are unused.
Since the table row data structure is stored in a dynamic array, the PDA's heap might be "polluted" by unnecessary non-used data.
A friend of mine advised me to create a class with a virtual intferace whose children classes contain the actual data members of different types and the methods' implementations.
That sounded good to me, but I'm stuck in implementing it, because at some point I need a specific data type, which actually differs from the implementation of the virtual interface.
This cannot be the right attempt, because data types cannot be overridden in children classes. I probably did not properly understand my friend, since I'm not an experienced C++ programmer.Code:class CBaseClass { public: virtual void setValue( ??? value ); virtual ??? getValue(); }
I was looking for hours for an answer on the net and now I'm totally confused about this.
My first idea was using an Array of void* pointers and cast the proper data type in the appropriate case, but that's no elegant solution.
I'd appreciate any pointer (no pun intended) to the right direction.
Thanks in advance!