S
Sandeep Pulla
Can anyone shed light on why the following gives the compile time
error:
'entity *surface_entity::clone(void)' : overloaded member function not
found in 'surface_entity'
=========================================================================
class entity {
public:
virtual entity* clone() const = 0;
};
class surface {
protected:
virtual void redo_caches() const {}
};
class surface_entity : public surface, public entity {
public:
surface_entity* clone() const { return new surface_entity(*this); }
private:
void redo_caches() const {}
};
=========================================================================
Whereas either
[a] Making either "clone()" OR "redo_caches()" non-virtual
or
Changing the order of base class declaration, i.e., "public
entity, public surface" instead of "public surface, public entity"
makes the error go away?
Thanks in advance,
Sandeep
p.s. the compiler is microsoft visual c++ 7
error:
'entity *surface_entity::clone(void)' : overloaded member function not
found in 'surface_entity'
=========================================================================
class entity {
public:
virtual entity* clone() const = 0;
};
class surface {
protected:
virtual void redo_caches() const {}
};
class surface_entity : public surface, public entity {
public:
surface_entity* clone() const { return new surface_entity(*this); }
private:
void redo_caches() const {}
};
=========================================================================
Whereas either
[a] Making either "clone()" OR "redo_caches()" non-virtual
or
Changing the order of base class declaration, i.e., "public
entity, public surface" instead of "public surface, public entity"
makes the error go away?
Thanks in advance,
Sandeep
p.s. the compiler is microsoft visual c++ 7