Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6150465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:37:00+00:00 2026-05-23T19:37:00+00:00

I am attempting to use a third party SDK (Crystal Space) and am encountering

  • 0

I am attempting to use a third party SDK (Crystal Space) and am encountering some problems.

The code (not mine) looks like this:

#define CS_EVENTHANDLER_PHASE_LOGIC(x)                  
CS_EVENTHANDLER_NAMES(x)                        
CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS                
virtual const csHandlerID * GenericPrec         
(csRef<iEventHandlerRegistry> &, csRef<iEventNameRegistry> &,       
 csEventID) const {                         
  return 0;                             
}                                   
virtual const csHandlerID * GenericSucc         
(csRef<iEventHandlerRegistry> &r1, csRef<iEventNameRegistry> &r2,   
 csEventID event) const {                       
  static csHandlerID succConstraint[6];                 
  if (event != csevFrame(r2))                       
    return 0;                               
  succConstraint[0] = FrameSignpost_Logic3D::StaticID(r1);      
  succConstraint[1] = FrameSignpost_3D2D::StaticID(r1);         
  succConstraint[2] = FrameSignpost_2DConsole::StaticID(r1);        
  succConstraint[3] = FrameSignpost_ConsoleDebug::StaticID(r1);     
  succConstraint[4] = FrameSignpost_DebugFrame::StaticID(r1);       
  succConstraint[5] = CS_HANDLERLIST_END;               
  return succConstraint;                        
}

#define CS_EVENTHANDLER_PHASE_3D(x)                 
CS_EVENTHANDLER_NAMES(x)                        
CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS                
virtual const csHandlerID * GenericPrec         
(csRef<iEventHandlerRegistry> &r1, csRef<iEventNameRegistry> &r2,   
 csEventID event) const {                       
  static csHandlerID precConstraint[2];                 
  if (event != csevFrame(r2))                       
    return 0;                               
  precConstraint[0] = FrameSignpost_Logic3D::StaticID(r1);      
  precConstraint[1] = CS_HANDLERLIST_END;               
  return precConstraint;                        
}                                   
virtual const csHandlerID * GenericSucc         
(csRef<iEventHandlerRegistry> &r1, csRef<iEventNameRegistry> &r2,   
 csEventID event) const {                       
  static csHandlerID succConstraint[5];                 
  if (event != csevFrame(r2))                       
    return 0;                               
  succConstraint[0] = FrameSignpost_3D2D::StaticID(r1);         
  succConstraint[1] = FrameSignpost_2DConsole::StaticID(r1);        
  succConstraint[2] = FrameSignpost_ConsoleDebug::StaticID(r1);     
  succConstraint[3] = FrameSignpost_DebugFrame::StaticID(r1);       
  succConstraint[4] = CS_HANDLERLIST_END;               
  return succConstraint;                        
}

(there are several more blocks like these with the same function names)

As you can see, they are overloading virtual cosnt functions.

When I have the code

CS_EVENTHANDLER_PHASE_LOGIC("application.cstest")

in my header file, I get this error:

error: 'virtual const csEventHandlerID* CSTest::GenericSucc(...) const cannot be overloaded'

This is repeated for GenericPrec, InstaceSucc and InstancePrec.

I haven’t been able to find any information on the Googles regarding this error. Nothing seems to indicate that virtual consts can’t be overloaded (and the developers seem to think so) so what is the compiler’s problem?

tl;dr:

Why can’t I overload virtual const functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:37:01+00:00Added an answer on May 23, 2026 at 7:37 pm

    Why can’t I overload virtual const functions?
    Ofcourse you can, provided you overload them and not create two methods with the same prototype.

    It is syntactically valid to overload virtual const functions.

    All you methods, GenericPrec(), InstaceSucc() and InstancePrec() have the very same prototype. To overload a function you must have either:

    Different no of arguments
    Different type of arguments
    Different sequence of arguments

    The function prototypes you have satisfy neither of the criteria and hence the compiler complains.

    Since it is a third party SDK I assume it must be at-least compilable and if So It seems only one of the two macros should be enabled at any given point of time, So that only one version of the functions is available. Those functions are not written to be overloaded.

    Also, You are missing out on giving an exact error message. The compiler will usually exactly tell you why it cannot overload a function.

    Check this.

    The compiler clearly gives the message:

    prog.cpp:4: error: ‘virtual void MyClass::doSomething(int) const’ cannot be overloaded
    prog.cpp:3: error: with ‘virtual void MyClass::doSomething(int) const’
    

    You have missed out in mentioning the second part of the error message which you posted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to use the following code to serialize an anonymous type to JSON:
I have this strange issue with some third party DLL's. The third party provider
I am attempting to use OpenSSL's SHA512 function in a C++ project of mine.
Question I have a third-party DLL that throws an unhandled exception when attempting to
I'm attempting to use the rest-client gem to post something, but for some reason,
First of all, I'm attempting to use faux namespaces in my JavaScript program like
I'm attempting to use HSlogger to get some information about my program. So I
In attempting to use the Performance Tools on an ASP.NET website I'm getting various
I'm attempting to use Mono to load a bitmap and print it on Linux
I'm attempting to use TinyXML to read and save from memory, instead of only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.