-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent.cpp
More file actions
59 lines (50 loc) · 1.32 KB
/
Copy pathstudent.cpp
File metadata and controls
59 lines (50 loc) · 1.32 KB
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
#include "program3.h"
//Default constructor
Student::Student()
{
szStudentID = "A00000000";
szStudentName = "Test Student";
}
//Parameterized constructor
Student::Student(string id, string name)
{
szStudentID = id;
szStudentName = name;
}
//Copy constructor
/*********************************************************************
Student(const Student& other)
Purpose:
Create new object by copying another object of same class.
Parameters:
I const Student& other -- the existing object
Return Value:
-
Notes:
Creates new memory and copies data
*********************************************************************/
Student::Student(const Student& other)
{
szStudentID = other.szStudentID;
szStudentName = other.szStudentName;
}
//Destructor
Student::~Student()
{
//No dynamic memory to release
}
/*********************************************************************
string getStudentInfo();
Purpose:
Return a string containing studentID and name, seperated by a colon with a space(: ) eg: A00000000: Test Student.
Parameters:
-
Return Value:
Returns the formatted string
Notes:
String concatenation has been used for the return.
*********************************************************************/
string Student::getStudentInfo()
{
return szStudentID + ": " + szStudentName;
}