add: main, << operator, name in const
This commit is contained in:
@ -28,7 +28,6 @@ Bureaucrat::~Bureaucrat()
|
||||
|
||||
Bureaucrat& Bureaucrat::operator=(const Bureaucrat &src)
|
||||
{
|
||||
this->_name = src._name;
|
||||
this->_grade = src._grade;
|
||||
|
||||
return *this;
|
||||
@ -43,11 +42,6 @@ void Bureaucrat::setGrade(int new_grade)
|
||||
this->_grade = new_grade;
|
||||
}
|
||||
|
||||
void Bureaucrat::setName(const std::string &new_name)
|
||||
{
|
||||
this->_name = new_name;
|
||||
}
|
||||
|
||||
const std::string& Bureaucrat::getName(void) const
|
||||
{
|
||||
return this->_name;
|
||||
@ -82,8 +76,8 @@ const char* Bureaucrat::GradeTooHighException::what() const throw()
|
||||
return "Too big grade";
|
||||
}
|
||||
|
||||
std::ostream& Bureaucrat::operator<<(std::ostream &stream)
|
||||
std::ostream& operator<<(std::ostream &stream, Bureaucrat &src)
|
||||
{
|
||||
stream << this->_name << ", bureaucrat grade " << this->_grade << "." << std::endl;
|
||||
stream << src.getName() << ", bureaucrat grade " << src.getGrade() << "." << std::endl;
|
||||
return stream;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user