Example #1
0
void Method::invoke(Object* const obj) {
	if (!obj->isInstanceOf(this->getDeclaringClass())) {
		throw MethodNotFound();
	}
	objectContext.push(obj);
	mFunction(obj);
	objectContext.pop();
}
Example #2
0
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();
}