forked from yogykwan/design-patterns-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.cc
More file actions
39 lines (29 loc) · 695 Bytes
/
proxy.cc
File metadata and controls
39 lines (29 loc) · 695 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
//
// Created by Jennica on 2016/12/29.
//
#include "proxy.h"
SchoolGirl::SchoolGirl(std::string name): name_(name) {
}
std::string SchoolGirl::GetName() {
return name_;
}
Pursuit::Pursuit(SchoolGirl *school_girl): school_girl_(school_girl){
}
void Pursuit::GiveFlowers() {
std::cout << "Give flowers to " << school_girl_->GetName() << std::endl;
}
void Pursuit::GiveDolls() {
std::cout << "Give dolls to " << school_girl_->GetName() << std::endl;
}
Proxy::Proxy(SchoolGirl *school_girl) {
pursuit_ = new Pursuit(school_girl);
}
Proxy::~Proxy() {
delete pursuit_;
}
void Proxy::GiveFlowers() {
pursuit_->GiveFlowers();
}
void Proxy::GiveDolls() {
pursuit_->GiveDolls();
}