#include "exceptions.hpp" #include "human.hpp" #include "school.hpp" #include "food.hpp" #include "life.hpp" void life::eat(food &f) { if(!f.tasty()) throw(error("WTF is it?!")); else { this->money -= f.price(); f = excrement; this->grow(); } } void life::sleep() { int sheep; for(sheep = 0; !asleep(); ++sheep) if(sheep<0) throw(astonishment("OMG!")); this->grow(); } void life::work( thing& t ) { t = nothing; error up("Okay, I messed it up"); throw up; } void life::haveFun() { throw(error("How is it possible?")); } void life::live() { while(this->alife_) { eat(); work(); haveFun(); eat(); sleep(); work(); haveFun(); eat(); work(); haveFun(); sleep(); } }
Monday, May 10, 2010
life.cpp
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment