forked from huihut/interview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconcrete_implementor.h
More file actions
44 lines (38 loc) · 869 Bytes
/
concrete_implementor.h
File metadata and controls
44 lines (38 loc) · 869 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Created by xiemenghui on 2018/7/21.
//
#ifndef DESIGNPATTERN_CONCRETE_IMPLEMENTOR_H
#define DESIGNPATTERN_CONCRETE_IMPLEMENTOR_H
#include "implementor.h"
#include <iostream>
// Electric lights
class Light : public IElectricalEquipment
{
public:
// Turn on the lights
virtual void PowerOn() override
{
std::cout << "Light is on." << std::endl;
}
// Turn off the lights
virtual void PowerOff() override
{
std::cout << "Light is off." << std::endl;
}
};
// Electric Fan
class Fan : public IElectricalEquipment
{
public:
// Turn on the fan
virtual void PowerOn() override
{
std::cout << "Fan is on." << std::endl;
}
// Turn off the fan
virtual void PowerOff() override
{
std::cout << "Fan is off." << std::endl;
}
};
#endif //DESIGNPATTERN_CONCRETE_IMPLEMENTOR_H