-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexC.cpp
57 lines (45 loc) · 862 Bytes
/
exC.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
#include <iostream>
#include <memory>
class Coord {
private:
int x;
int y;
public:
Coord(); // Construtor
void set_coord(int x_new, int y_new);
};
void Coord::set_coord(int x_new, int y_new) {
x = x_new;
y = y_new;
}
Coord::Coord() {
}
class Cube {
private:
int x;
int y;
int z;
public:
Cube();
void set_cube(int x_new, int y_new, int z_new);
void get_volume();
};
void Cube::set_cube(int x_new, int y_new, int z_new) {
x = x_new;
y = y_new;
z = z_new;
}
void Cube::get_volume() {
int vol = x * y * z;
std::cout << vol << std::endl;
}
Cube::Cube(){
}
int main() {
std::unique_ptr<Coord> c1 (new Coord);
c1 -> set_coord (5,10);
std::unique_ptr<Cube> c2 (new Cube);
c2 -> set_cube(5,2,3);
c2 -> get_volume();
return 0;
}