Skip to main content
gamedev.net
🔒 Locked

Pure Virtual Function overloading

Started by GekkoCube Feb 14, 2003 at 10:26 PM 1 replies 200+ views
Original Post
GekkoCube
GekkoCube
My base class has two overloaded pure virtual functions... example, they look something like this:
  
virtual int Create() = 0;
virtual int Create( float value ) = 0;
  
Classes that derive from this base class has the second function (int Create( float value )...but they dont overload the first one (int Create(). And this appears to spring up errors. here is the list of errors. Please help me if you can. thanks.
  
c:\documents and settings\edward\desktop\projects\deep green\main.cpp(50) : error C2259: ''CSkybox'' : cannot instantiate abstract class due to following members:
        c:\documents and settings\edward\desktop\projects\deep green\cskybox.h(9) : see declaration of ''CSkybox''
c:\documents and settings\edward\desktop\projects\deep green\main.cpp(50) : warning C4259: ''int __thiscall CObject::Create(void)'' : pure virtual function was not defined
        c:\documents and settings\edward\desktop\projects\deep green\cobject.h(16) : see declaration of ''Create''
c:\documents and settings\edward\desktop\projects\deep green\main.cpp(50) : error C2259: ''CSkybox'' : cannot instantiate abstract class due to following members:
        c:\documents and settings\edward\desktop\projects\deep green\cskybox.h(9) : see declaration of ''CSkybox''
c:\documents and settings\edward\desktop\projects\deep green\main.cpp(50) : warning C4259: ''int __thiscall CObject::Create(void)'' : pure virtual function was not defined
        c:\documents and settings\edward\desktop\projects\deep green\cobject.h(16) : see declaration of ''Create''
CEngine.cpp
  
niyaw
niyaw
you have to override all pure virtual functions before you can instantiate a class.

[edited by - niyaw on February 14, 2003 11:29:37 PM]
krez
krez
yah, you have to either override it in the derived class, or don''t make it pure virtual (i.e. give it a empty body, instead of the "=0").
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.