The C++ Version: Part 3
my_database.add_employee(“Mary”, 40000);
my_database.add_employee(“Mark”, 50000);
my_database.add_employee(“Shlomit”, 34000);
// We haven’t explicitly defined the num_employees() and
// employee() accessor functions, but they should be
for (int i = 0; i < my_database.num_employees(); i++) {
// This would work if you give the employee class an
// accessor function called name()
print(“Name is: %s\n”, my_database.employee(i)->name();
// A more C++-ish thing to do, however, is to give the
// employee class a function called print() that knows
// how to print its name out. In that case:
my_database.employee(i)->print();