enum Address
{
Taipei,
Taichung,
Kaoshung
};
enum Job
{
Accounting,
SoftwareEngineer,
CEO
};
class Alien
{
protected:
std::string m_sName;
Address m_Addr;
Job m_Job;
public:
Alien(std::string& sName) : m_sName(sName) { }
~Alien() { }
std::string TellName() { return m_sName; }
std::string TellPlace() { return m_Addr; }
std::string TellOccupation() { return m_Job; }
void MoveTo(Address addr) { m_Addr = addr; }
void GetJob(Job job) { m_Job = job; }
};
int main(int argc, char* argc[])
{
Alien man("老頑童");
man.GetJob(SoftwareEngineer);
man.MoveTo(Taipei);
std::cout << "名稱: " << man.TellName() << std::endl;
std::cout << "所在地: " << man.TellPlace() << std::endl;
std::cout << "工作: " << man.TellOccupation() << std::endl;
}