Class One : public Two
{
public:
One()
{
Three three;
cout << "something";
}
private:
Four _four;
};
I need to show the sentence: "One Two Three Four Five Six Sevens" and class One should remain as they are. Each class cannot display more than one word in its constructor and destructor.
So ... I realized that my base class is the fourth class. I also did constr. and destruction. in each class and tried to write something in their bodies, but this is what ive got on the output:
Class Four Constructor:
Class Three Constructor:
Class Two Constructor:
Class Four Constructor:
Class Four Constructor:
Class Three Constructor:
Class One Constructor:
Class Three Destructor:
Class Four Destructor:
DESTRUCTION:
Class One Destructor:
Class Four Destructor:
Class Two Destructor:
Class Three Destructor:
Class Four Destructor:
my main function:
int main()
{
One one;
cout << endl;
cout << "DESTRUCTION:\n";
}
I have read several articles on inheritance, but still don't know how to show words in constr classes. and destructors, but do not do this twice or even more, even if I create objects of these classes, as is done in the first class.
PS Sorry for the grammar and other mistakes;)
source
share