-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.hpp
37 lines (32 loc) · 1.45 KB
/
Student.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
#pragma once
#include <cstring>
#include <iostream>
using namespace std;
class Student
{
private:
int id;
string firstName;
string middleName;
string lastName;
public:
Student(int id, string firstName, string middleName, string lastName) : id(id), firstName(firstName), middleName(middleName), lastName(lastName) {}
Student() : id(0) {}
public:
int GetId() const { return this->id; }
string GetFirstName() const { return this->firstName; }
string GetMiddleName() const { return this->middleName; }
string GetLastName() const { return this->lastName; }
void Print() const { cout << this->id << ' ' << this->firstName << ' ' << this->middleName << ' ' << this->lastName << '\n'; }
bool operator == (const Student& another) { return (this->firstName == another.GetFirstName() && this->middleName == another.GetMiddleName() && this->lastName == another.GetLastName()); }
bool operator != (const Student& another) { return (this->firstName == another.GetFirstName() && this->middleName == another.GetMiddleName() && this->lastName == another.GetLastName()); }
Student& operator = (const Student* another)
{
if(this == another) return *this;
this->id = another->GetId();
this->firstName = another->GetFirstName();
this->middleName = another->GetMiddleName();
this->lastName = another->GetLastName();
return *this;
}
};