Skip to content
Snippets Groups Projects
Student.cpp 1.05 KiB
Newer Older
  • Learn to ignore specific revisions
  • Pelotrio's avatar
    Pelotrio committed
    #include "Student.h"
    
    Student::Student(std::string lastName, std::string firstName) : lastName(lastName), firstName(firstName),
                                                                    matriculationNumber(generateMatriculationNumber()) {
        nextStudent = nullptr;
    
    Pelotrio's avatar
    Pelotrio committed
        previousStudent = nullptr;
    
    Pelotrio's avatar
    Pelotrio committed
    }
    
    std::string Student::getLastName() const {
        return lastName;
    }
    
    std::string Student::getFirstName() const {
        return firstName;
    }
    
    int Student::getMatriculationNumber() const {
        return matriculationNumber;
    }
    
    Student *Student::getNextStudent() const {
        return nextStudent;
    }
    
    void Student::setNextStudent(Student *nextStudent) {
        this->nextStudent = nextStudent;
    }
    
    
    Pelotrio's avatar
    Pelotrio committed
    Student *Student::getPreviousStudent() const {
        return previousStudent;
    }
    
    void Student::setPreviousStudent(Student *previousStudent) {
        this->previousStudent = previousStudent;
    }
    
    
    Pelotrio's avatar
    Pelotrio committed
    int Student::generateMatriculationNumber() {
    
    Pelotrio's avatar
    Pelotrio committed
        // Generate the matriculation number starting from 1000000 and counting up.
        static int matriculationNumber = 1000000;
        return matriculationNumber++;
    }