-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (20 loc) · 785 Bytes
/
Copy pathmain.cpp
File metadata and controls
27 lines (20 loc) · 785 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
#include <iostream>
#include "Student.h"
#include "Teacher.h" // include Student.h again
using namespace std;
int main() {
Student s1("Tony", "6110401234");
s1.addScore(30);
cout << "Student Name: " << s1.getName() << endl;
cout << "Score: " << s1.getScore() << endl;
cout << "--------------------------------" << endl;
Teacher t1("Stan");
cout << "-------- Pass by value --------" << endl;
t1.giveScore(s1, 30); // pass by value
cout << "Student Name: " << s1.getName() << endl;
cout << "Score: " << s1.getScore() << endl;
cout << "------- Pass by reference ------" << endl;
t1.giveScore(&s1, 30); // pass by reference
cout << "Student Name: " << s1.getName() << endl;
cout << "Score: " << s1.getScore() << endl;
}