-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent.h
90 lines (80 loc) · 2.26 KB
/
student.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//============================================================================
// Name : student.h
// Author : Alexander M. Westphal / Paul Schröder
// Version : Version 1.0
// Copyright : Alexander M. Westphal / Paul Schröder
// Description : Header-File for the Sutdent Object.
// Compiler and C++ Version: GNU GCC / C++11 Standard
//============================================================================
#include <ostream>
#include <cstring>
#ifndef STUDENT_H_
#define STUDENT_H_
using namespace std;
class Student {
public:
/**
* Constructor and Destructor
*/
Student(int MatrikelNummer, char* name, char* vorname, int geb);
Student();
/**
* Getter for the Student-object
*/
const int getMatrikelNumber() const;
char* getName();
char* getVorname();
int getGeburtstag();
/**
* Setter for Student
*/
void setMatrikelNumber(const int number);
void setName(char* naName);
void setVorname(char* voName);
void setGeburtstag(const int geb);
/**
* Operator for the sutdent object
*/
bool operator == (const Student &other);
bool operator != (Student &other);
bool operator <= (Student &other);
bool operator >= (Student &other);
bool operator < (Student &other);
bool operator > (Student &other);
/**
* write und read function for streams.
*/
virtual void write(ostream& ostr);
virtual void read(istream& istr);
/**
* Attributes
*/
private:
int matrikelNummer;
char name[10];
char vorname[10];
int geburtstag;
};
/**
* Overloading of the << operator.
* Will return a outputstream containing the student.
* @param ostr outputstream
* @param stud student opject
* @return will return a output stream
*/
ostream& operator << (ostream& ostr,Student& stud) {
stud.write(ostr);
return ostr;
}
/**
* Overloading of the >> operator.
* Will return a input stream and read the student from it.
* @param istr input stream as param
* @param stud student-object
* @return will return a input stream
*/
istream& operator >> (istream& istr, Student& stud) {
stud.read(istr);
return istr;
}
#endif /* STUDENT_H_ */