Skip to main content
gamedev.net
🔒 Locked

const overloading, registering with asMETHOD

Started by blubberbernd Aug 25, 2011 at 4:03 PM 1 replies 1.5k views
Original Post
blubberbernd
blubberbernd
Hi,

I currently have this problem. I have a class with two identical member functions, one const, the other not const:


class MyClass
{
public:
obj* getObj() {return o;}
const obj* getObj() const {return o;}
}


If I now want to register MyClass::getObj() to AS with engine->RegisterObjectMethod(), I can't to this because I get the error "Invalid overload of asMETHOD(...)".

Obviously this is because I have two functions with the same name and parameters. How do I solve this problem?
SiCrane
SiCrane
You would want to use asMETHODPR() rather than asMETHOD(). Examples of use are on the Registering a function documentation page.

Topic Locked

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

Sign in to reply to this topic.