class CarDecoratorProgress Tracker public CarDecorator bool mHaveDoors

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class CarDecoratorProgressTracker : public CarDecorator
{
bool mHaveDoors;
bool mHaveEngine;
bool mHaveWheels;
...
virtual void addEngine(Engine* engine)
{
if (engine)
mHaveEngine = true;
CarDecorator::addEngine(engine);
}
virtual void addDoors(Door* doors, int doorsCount)
{
if (doorsCount && doors)
mHaveDoors = true;
CarDecorator::addDoors(doors, doorsCount);
}
...
virtual bool readyToMove()
{
return (mHaveDoors && mHaveEngine && mHaveWheels);
};
};