What is the neatest way of having a class like this,
class Object
{
public:
virtual Object* Find(string name);
};
implemented so that its derived classes' Find()
method automatically returns the derived class type without having to do something like this:
class DerivedObject : public Object
{
public:
DerivedObject* Find(string name);
};
manually?
Extra: actually in my real implementation it's a bunch of static
functions, not virtual
ones. I've got functions like static Object* Object::Find(string name)
and static GameObject* GameObject::Find(string name)
.