lass Person
{
public:
Person( string, string, int );
void setFirstName( string );
string getFirstName();
void setLastName( string );
string getLastName();
void setAge( int );
int getAge();
private:
string firstName;
string lastName;
int age;
}; // end class Person
// Person.cpp
// Creates and manipulates a person with a first name, last name and age
#include "Person.h"
Person::Person( string first, string last, int years )
{
setFirstName(first);
setLastName(last);
if ( years < 0 )
setAge(years) ;
} // end Person constructor
void Person::setFirstName( string first )
{
firstName = first;
} // end function setFirstName
string Person::getFirstName()
{
return firstName;
} // end function getFirstName
void Person::setLastName( string last )
{
lastName = last;
} // end function setLastName
string Person::getLastName()
{
return lastName;
} // end function getLastName
void Person::setAge( int years )
{
if ( years > 0 )
age = years;
} // end function setAge
int Person::getAge()
{
return years;
} // end function getAge