void Method::invoke(Object* const obj) { if (!obj->isInstanceOf(this->getDeclaringClass())) { throw MethodNotFound(); } objectContext.push(obj); mFunction(obj); objectContext.pop(); }
Method Class::getMethod(std::string name) { for (std::list<Method>::iterator i = methods.begin(); i != methods.end(); i++) { if (i->name() == name) return *i; } if (ancestor != NULL) { return ancestor->getMethod(name); } throw MethodNotFound(); }