#include #include "student.h" /** Student constructor. Takes as input the initial name and id number of the student. */ Student::Student(string init_name, int init_id) { name = new string(init_name); id = init_id; } /** Student destructor. Deletes dynamically allocated name. */ Student::~Student() { delete name; } /** Student copy constructor. Takes as input a constant reference to the Student object which should be copied. */ Student::Student(const Student & rhs) { name = new string(*rhs.name); id = rhs.id; } /** Copy assignment operator for Student. Takes as input a constant reference to the Student object which should be copied. Returns a constant reference to this Student object. */ const Student & Student::operator=(const Student & rhs) { if(this != &rhs) { *name = *rhs.name; id = rhs.id; } return *this; } /** Returns the name of the Student. */ string Student::getName() const { return *name; } /** Changes the name of the student to newname. */ void Student::setName(string newname) { *name = newname; } /** Returns the id of the Student. */ int Student::getID() const { return id; } /** Changes the id of the Student to newid. */ void Student::setID(int newid) { id = newid; } /** Prints the name and id of this Student to standard output. */ void Student::print() { cout << "Name: " << *name << endl; cout << "ID: " << id << endl; }