Advanced Inheritance 551
16
70: void rPrintFunc(const Employee&);
71:
72: int main()
73: {
74: Employee Edie(“Jane”,”Doe”,”1461 Shore Parkway”, 20000);
75: Edie.SetSalary(20000);
76: Edie.SetFirstName(“Edythe”);
77: String LastName(“Levine”);
78: Edie.SetLastName(LastName);
79:
80: cout << “Constructor count: “ ;
81: cout << String::ConstructorCount << endl;
82: rPrintFunc(Edie);
83: cout << “Constructor count: “;
84: cout << String::ConstructorCount << endl;
85: PrintFunc(Edie);
86: cout << “Constructor count: “;
87: cout << String::ConstructorCount << endl;
88: return 0;
89: }
90: void PrintFunc (Employee Edie)
91: {
92: cout << “Name: “;
93: cout << Edie.GetFirstName().GetString();
94: cout << “ “ << Edie.GetLastName().GetString();
95: cout << “.\nAddress: “;
96: cout << Edie.GetAddress().GetString();
97: cout << “.\nSalary: “ ;
98: cout << Edie.GetSalary();
99: cout << endl;
100: }
101:
102: void rPrintFunc (const Employee& Edie)
103: {
104: cout << “Name: “;
105: cout << Edie.GetFirstName().GetString();
106: cout << “ “ << Edie.GetLastName().GetString();
107: cout << “\nAddress: “;
108: cout << Edie.GetAddress().GetString();
109: cout << “\nSalary: “ ;
110: cout << Edie.GetSalary();
111: cout << endl;
112: }
String(char*) constructor
String(char*) constructor
String(char*) constructor
String(char*) constructor
String destructor
String(char*) constructor
OUTPUT
LISTING16.4 continued