-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudents.cpp
More file actions
53 lines (43 loc) · 862 Bytes
/
students.cpp
File metadata and controls
53 lines (43 loc) · 862 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
// Author : Sabituddin Bigbang
#include <iostream>
using namespace std;
class Students {
public:
// constructor
Students() {
name = "anonim";
age = 19;
city = "Bandung";
}
// constructor by paramete
Students(const char* _name, int _age, const char* _city) {
name = _name;
age = _age;
city = _city;
}
// Destructor
~Students() {
cout << "Hello, it's destructor!" << endl;
}
// Setter
// Getter
// Other Method
void printStudent() {
cout << "---------your identity--------" << endl;
cout << "Name : " << name << endl;
cout << "Age : " << age << endl;
cout << "City : " << city << endl;
}
private:
const char * name;
int age;
const char * city;
};
int main() {
cout << " Object Oriented Programming " << endl;
Students S1;
Students S2("Rambo",69,"Jakarta");
S1.printStudent();
S2.printStudent();
return 0;
}