using namespace std;
class Engine
{
public:
void Start() { cout<<"engine started"<
class Headlights
{
public:
void TurnOn() { cout<<"Headlight on"<
// That's your facade.
class Car
{
private:
Engine engine;
Headlights headlights;
public:
void TurnIgnitionKeyOn()
{
headlights.TurnOn();
engine.Start();
}
};
int main(int argc, char *argv[])
{
// Consuming facade.
Car car;
car.TurnIgnitionKeyOn();
return 0;
}
No comments:
Post a Comment