Let say I have some data structure in a class as follow
class DataStructure
{
DataStructure();
~DataStructure();
void reset();
void init();
void setiX();
...;
int getiX();
double get dx();
void addToList(OtherDataStructure dt);
private:
int ix;
int iy;
int iz;
double dx;
...;
vector<OtherDataStructure> dtStVec;
};
so I usually have this class used as the following way
class manageSomething
{
manageSomething();
~manageSomething();
func1();
func2();
...;
funcN();
private:
some vatiables;
DataStructure structure; //HERE
};
so I usually have to use getters and setters to access the data structure variables
is it better inherit the data structure, and access all element directly, if the inheriting class is not in the main application, as follow
class manageSomething : public DataStructure
{
manageSomething();
~manageSomething();
func1();
func2();
...;
funcN();
private:
some vatiables;
};
so the usage of manageSomething is used as
int main()
{
manageSomething manager;
///manager.stuff ....
return EXIT_SUCCESS;
}
and when do we decide which one to choose from?