Files
BasicsOfComputerSoftwareEng…/大作业/Student.hpp

33 lines
922 B
C++

#pragma once
#include <string>
class Student {
private:
int number;
std::string name;
bool isAnyNumber;
bool isAnyName;
public:
Student();
Student(const int _number, const std::string _name);
// Returns student number.
const int getNumber() const;
// Returns the string from of the number, so as to display "any"
const std::string getNumberString() const;
// Returns student name.
const std::string getName() const;
// Set the new number
void setNumber(const int newNumber);
// Set the new name
void setName(const std::string newName);
// Set the number to "any"
void setAnyNumber();
// Set the name to "any"
void setAnyName();
bool matchesNumber(const Student &otherStu) const;
bool matchesName(const Student &otherStu) const;
bool matches(const Student &otherStu) const;
bool operator==(const Student &otherStu) const;
};