-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemoAggregation.h
More file actions
54 lines (45 loc) · 752 Bytes
/
Copy pathDemoAggregation.h
File metadata and controls
54 lines (45 loc) · 752 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
45
46
47
48
49
50
51
52
53
54
#pragma once
#include <iostream>
#include <string>
using namespace std;
class AggregationDemo
{
class Hat
{
public:
string color;
string model;
double price;
};
class Person
{
public:
string name;
Hat* hat;
void TakeHat(Hat* hat)
{
this->hat = hat;
}
void GoWalk()
{
cout << "âíåçàïíî ïîäóë âåòåð...\n";
hat = nullptr;
}
void WhereIsYourHat()
{
cout << "where is your ha-a-at, is your ha-a-at, person? à âîò îíà: " << hat << "\n";
}
};
public:
static void Test()
{
Hat* nice_hat = new Hat();
Person alex;
alex.TakeHat(nice_hat);
alex.WhereIsYourHat();
alex.GoWalk();
alex.WhereIsYourHat();
cout << "øëÿïà ëåòèò â ìåéíå: " << nice_hat << "\n";
}
};
// AggregationDemo::Test();