to inherit or not to inherit ...
Moin,
I need an advice in the following case ...
I want to create a control from scratch, a Tab Control.
In the moment I've created a simple struct for the TabItems and a class for the TabWindow.
Code:
struct TabItem {
LPCTSTR itemText;
unsigned itemID;
RECT itemRect;
};
class TabWindow {
/* Con- / Destructors
... */
private:
TabItem* tabItems; // pointer to an array of TabItems
/* ... */
};
Does it make sense, or do I get advantages, if I let TabWindow derive from TabItem ?
Or is it unnessecery, because there are no advantages ...
Code:
class TabItem {
LPCTSTR itemText;
unsigned itemID;
RECT itemRect;
};
class TabWindow : private TabItem {
/* Con- / Destructors
... */
private:
TabItem* tabItems; // pointer to an array of TabItems
/* ... */
};
Thanks for reply. :)
Greetz
Greenhorn