You cannot instantiate a an abstract class. This is not only a technical constraint but in fact a conceptual one.
So why do you want to pass the drawable object by reference ? Maybe for protection ?
In this case you can use reference to const:
int registerObject(const DrawableObject& dObject);
On Mon, May 12, 2008 at 10:16 PM, Ali Helmy <alihelmy@...> wrote:
Hey mates,Ive got this abstract class, DrawableObject that has just one func (of interest to this mail) which isclass DrawableObject{virtual void draw() = 0;};now, i have another class, that is GfxEngine and it has one func,class GfxEngine{int registerObject(DrawableObject& dObject);
};now here is my dilemma, if i keep the drawable object abstract, then i cannot pass it by value to the gfx engine func, since i cannot instantiate it, ie: the func signature cannot be int registerObject(DrawableObject dObject), and i do not want to pass it by reference, so... any ideas?---Cheers,seth<A. Helmy>One life... LIVE it!
--
Ahmed Said Hefny
Cairo University
Faculty of Engineering
Computer Engineering Department