add input for ex8.1
This commit is contained in:
parent
eda4bd18ba
commit
17845570ef
1 changed files with 33 additions and 0 deletions
33
ex8.1/Employee.hh
Normal file
33
ex8.1/Employee.hh
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef EMPLOYEE_HH
|
||||
#define EMPLOYEE_HH
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
using namespace std ;
|
||||
|
||||
class Employee {
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Employee(const char* name, double salary) : _name(name), _salary(salary) {}
|
||||
|
||||
// Accessors
|
||||
const char* name() const { return _name.c_str() ; }
|
||||
double salary() const { return _salary ; }
|
||||
|
||||
// Print functions
|
||||
void businessCard(ostream& os = cout) const {
|
||||
os << " +------------------+ " << endl
|
||||
<< " | ACME Corporation | " << endl
|
||||
<< " +------------------+ " << endl
|
||||
<< " " << name() << endl ;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
string _name ;
|
||||
double _salary ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
Reference in a new issue