Hey guys i'll show the code first then explain my problem:
Class A
{
/*Variables required by A, B, C and D */
/*functions required by B and C*/
};
Class B
{
/*some of it's own functions and variables*/
};
Class C
{
/*some of it's own functions and variables*/
};
Class D
{
/*calls all the functions in A, B and C*/
};
So basically, I need the above and wondered what would be the best system design. I was thinking of using virtual functions with inheritance but then I come with the issue that if I make an object to access the class B, that same objects data will need to be used by the object I make for class C. Eg:
B bdata;
bdata.function();
C cdata;
/* add some function here to input all of the object bdata's data into cdata*/
cdata.function(); /* in order to get this function to work, it requires the data from bdata*/
So, my questions are:
1. What is the best system design and why? (I don't want to challenge you, i'd like to know the reason behind it to enhance my knowledge)
2. Is it possible to share object data between objects?
Also, please try not to get too technical, I have a bit of knowledge on C++ but it's not that great.
Thanks for your help!