// Project AllPersons // File allpersons.cpp #include "allpersons.h" AllPersons::AllPersons(int theMaxSize) { maxSize = theMaxSize; array = new Person[maxSize]; curSize = 0; } // The Person object p is copied into // the array. void AllPersons::add(Person p) { array[curSize++] = p; } char AllPersons::getGender(string name) { int i; Person p; for(i = 0; i < curSize; i++) { p = array[i]; if (p.getName() == name) return p.getGender(); } return 'U'; } int AllPersons::getAge(string name) { int i; Person p; for(i = 0; i < curSize; i++) { p = array[i]; if (p.getName() == name) return p.getAge(); } return -1; }