-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student.h
57 lines (48 loc) · 930 Bytes
/
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
#ifndef __STUDENT__
#define __STUDENT__
#define NAME_LENGTH 20
#define DEPT_LENGTH 10
#pragma pack(push, 1)
class Student
{
private:
char name[NAME_LENGTH];
unsigned ID;
float score;
char dept[DEPT_LENGTH];
public:
Student(const char *name, unsigned id, float score, const char *dept);
Student(const Student& student);
const char* getName(void) const;
unsigned getID(void) const;
void setID(unsigned newID);
float getScore(void) const;
void setScore(float newScore);
const char* getDept(void) const;
};
#pragma pack(pop)
inline const char* Student::getName(void) const
{
return name;
}
inline unsigned Student::getID(void) const
{
return ID;
}
inline void Student::setID(unsigned newID)
{
ID = newID;
}
inline float Student::getScore(void) const
{
return score;
}
inline void Student::setScore(float newScore)
{
score = newScore;
}
inline const char* Student::getDept(void) const
{
return dept;
}
#endif