-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
56 lines (43 loc) · 1016 Bytes
/
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
#include <iostream>
#include <string>
#include <vector>
#include "Student.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() {
static int i = 20;
i++;
std::cout << i << std::endl;
}
int main() {
std::cout << Student::test(20) << std::endl;
main3();
main3();
return 0;
}