-
Notifications
You must be signed in to change notification settings - Fork 0
/
diamond_problem.cpp
64 lines (48 loc) · 1.34 KB
/
diamond_problem.cpp
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
55
56
57
58
59
60
61
62
63
64
#include <iostream>
using std::string, std::cout, std::endl;
class Data {
public:
void set_label(string label) {
this->label = label;
};
protected:
string label;
};
class Content {
public:
void set_label(string label) {
this->label = label;
};
protected:
string label;
};
class Snippet: public Data, public Content {
public:
void set_data_label(string label) {
Data::label = label;
}
void set_content_label(string label) {
Content::label = label;
}
void set_core(string core) {
this->core = core;
}
void show() {
cout << "Data label: " << Data::label << endl
<< "Content label: " << Content::label << endl
<< "Snippet core: " << core << endl << endl;
}
private:
string core;
};
int main() {
Snippet ancient_summerian_inventory_list;
ancient_summerian_inventory_list.set_data_label("Inventory list");
ancient_summerian_inventory_list.set_content_label("Sumerian text");
ancient_summerian_inventory_list.set_core("Some text in cuneiform writing...");
ancient_summerian_inventory_list.show();
// ancient_summerian_inventory_list.set_label("Ancient summerian inventory list");
ancient_summerian_inventory_list.Data::set_label("Summerian inventory list");
ancient_summerian_inventory_list.Content::set_label("Ancient summerian text");
ancient_summerian_inventory_list.show();
}