/********************************************************************* C201 Computer Programming II Fall 2006 Dana Vrajitoru & Implementation of the class Lifeform. **********************************************************************/ #include "lifeform.h" #include using namespace std; // Changes the life_floag to false. void Lifeform::Die() { life_flag = false; } // Constructors Lifeform::Lifeform() : name(""), life_flag(true), is_mobile(false) { ; } Lifeform::Lifeform(string n) : name(n), age(0), life_flag(true), is_mobile(false) { ; } // nothing else to do // Destructor just to show what happens. Lifeform::~Lifeform() { cout << "Destroying the lifeform." << endl; } // Tells us if the lifeform is alive bool Lifeform::Is_alive() { return life_flag; } // Tells us if the lifeform is mortal bool Lifeform::Is_mortal() { return true; } // Sets the value of the name void Lifeform::Set_name(string n) { name = n; } // Sets the mobility to true. void Lifeform::Set_mobile() { is_mobile = true; } // Sets the mobility to false. void Lifeform::Set_imobile() { is_mobile = false; } // Outputs the name of the lifeform. void Lifeform::Output_name() { cout << name; }