Thanks for your advice, but I don't think that understanding inheritance is my problem, since I'm rather new to C++ but not object-oriented programming.
The abstract class was only an idea for solving this "dynamic data structure" issue.
The "base" class should provide a get and a set interface method which are supposed to be overridden by descendant classes for setting and retrieving different data types.
Given the following case:
Code:
class Base
{
};
class A : public Base
{
public:
int get() { return _value; }
void set ( int value ) { _value = value; }
private:
int _value;
};
class B : public Base
{
public:
string get() { return _value; }
void set ( string value ) { _value = value; }
private:
string _value;
};
typedef CArray<Base> MyTableRow
class MyTable
{
....
protected:
CArray<MyTableRow> _myTableRows
};
I would like to know how to access A's or B's get and set methods from _myTableRows.
Since I do not think, that this attempt leads to the right direction, I ask you, whether there is a different way to solve my problem of a dynamic data structure without creating lots of different methods which do actually the same on different data types.
I hope I could clearly explain myself this time...