-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
68 lines (51 loc) · 1.26 KB
/
main.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
65
66
67
68
#include <iostream>
#include <string>
#include <vector>
#include "Student.h"
#include "MyVector.h"
void main1() {
Student me {
"Utkan", 26
}; // Brace initializer
Student copy_of_me = me;
Student * pointer_to_me = &me;
Student & reference_to_me = me;
(*pointer_to_me).age = 20;
copy_of_me.age = 30;
reference_to_me.age = 40;
std::cout << "Hello, World!" << me.age << std::endl;
}
void main2() {
Student me {
"Utkan", 26
}; // Brace initializer
Student somebody {
"Ali", 27
};
Student copy_of_me = me;
Student * pointer_to_me = &me;
Student & reference_to_me = me;
reference_to_me = somebody;
// me = somebody;
std::cout << &me << std::endl;
std::cout << &somebody << std::endl;
std::cout << &reference_to_me << std::endl;
}
void main3(int);
int main() {
// std::vector<int> a{};
// std::cout << a.at(5) << std::endl;
{
MyVector<Student> vec{};
vec.append(Student{"Utkan", 26});
vec.append(Student{"Ayse", 20});
std::cout << vec.get(0).age << std::endl
<< vec.get(1).age << std::endl;
}
return 0;
}
void main3(int q) {
static int i = 20;
i++;
std::cout << i << q << std::endl;
}