-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPerson.hpp
47 lines (35 loc) · 986 Bytes
/
Person.hpp
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
// Person.hpp
#pragma once
#include <string>
#include "Misc.hpp"
using namespace std;
string namesArr[] = { "Adam", "Piotr", "Jakub", "Stefan", "Kacper", "Julian", "Jan", "Sebastian", "Janusz", "Maciej", "Marek" };
class Person {
public:
string name;
short int age;
Person() {
name = namesArr[randomNumber(0, 10)];
age = randomNumber(1, 99);
}
friend ostream& operator << (ostream& os, const Person* prs) {
os << prs->name << " " << prs->age << "\n";
return os;
}
friend ostream& operator << (ostream& os, const Person& prs) {
os << prs.name << " " << prs.age << "\n";
return os;
}
bool operator > (const Person& prs) {
return this->age > prs.age;
}
bool operator > (const Person* prs) {
return this->age > prs->age;
}
bool operator < (const Person& prs) {
return this->age < prs.age;
}
bool operator < (const Person* prs) {
return this->age < prs->age;
}
};