< previous page page_326 next page >

Page 326
LISTING 20.4 continued
d5ef64f4d3250b96ba5c07ca5bbc2f56.gif
17:       void SetLastName(const String & lName) {itsLastName = lName; }
18:       void SetAddress(const String & address) { itsAddress = address; }
19:       void SetSalary(long salary) { itsSalary = salary; }
20:    private:
21:       String itsFirstName;
22:       String itsLastName;
23:       String itsAddress;
24:       long itsSalary;
25:    };
26:
27:    Employee::Employee():
28:       itsFirstName(),
29:       itsLastName(),
30:       itsAddress(),
31:       itsSalary(0)
32:    {}
33:
34:    Employee::Employee(char * firstName, char * lastName,
35:       char * address, long salary):
36:       itsFirstName(firstName),
37:       itsLastName(lastName),
38:       itsAddress(address),
39:       itsSalary(salary)
40:    {}
41:
42:    Employee::Employee(const Employee & rhs):
43:       itsFirstName(rhs.GetFirstName()),
44:       itsLastName(rhs.GetLastName()),
45:       itsAddress(rhs.GetAddress()),
46:       itsSalary(rhs.GetSalary())
47:    {}
48:
49:    Employee::~Employee() {}
50:
51:    Employee & Employee::operator= (const Employee & rhs)
52:    {
53:       if (this == &rhs)
54:          return *this;
55:
56:       itsFirstName = rhs.GetFirstName();
57:       itsLastName = rhs.GetLastName();
58:       itsAddress = rhs.GetAddress();
59:       itsSalary = rhs.GetSalary();
60:
61:       return *this;
62:    }
63:
64:    int main()
65:    {
d5ef64f4d3250b96ba5c07ca5bbc2f56.gif
continues

 
< previous page page_326 next page >

If you like this book, buy it!