legal
illegal - can't dereference an int *y
legal
illegal - can't dereference an int *y
legal
legal
legal
illegal - *x is an int and array is an address
illegal - *x is an int and &array[0] is an address
Answer #9
Answer #10class Person { public: Person(void); ~Person(void); void Set(const char* first, const char* last, int age); void Display(void) const; private: char* first; char* last; int age; };
Answer #11Person::Person(void) { delete [] first; delete [] last; }
Answer #12Person(const Person& otherPerson);
Answer to Extra CreditPerson person[50];
Person::Person(const Person& otherPerson) { age = otherPerson.age; first = new char[strlen(otherPerson.first) + 1]; assert(first); strcpy(first, otherPerson.first); last = new char[strlen(otherPerson.last) + 1]; assert(last); strcpy(last, otherPerson.last); }