bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bayonne-devel] call c++ method by string name + passing parameters


From: gafferuk
Subject: Re: [Bayonne-devel] call c++ method by string name + passing parameters
Date: Sat, 16 Jan 2010 22:25:55 -0800 (PST)



gafferuk wrote:
> 
> Im trying to create my own scripting engine/language.
> 
> Is it possible to call a c++ class method by string name and also pass in
> the parameters?
> 
> for example I have a class called MyClass with a method called callme:
> 
> bool MyClass::callme(string name)
> {
>     cout << "Hello " << name.c_str() << "\n";
> 
>     return true;
> }
> 
> Normally would call it by using:
> 
> bool res = myClass->callMe("Harry");
> 
> what I want is a command like:
> 
> bool res = callAMethod("MyClass", "callme", "Harry");
> 
> any ideas to get something like that?
> 
> 
> 

found what i need:

http://stackoverflow.com/questions/801070/dynamically-invoking-any-function-by-passing-function-name-as-string
-- 
View this message in context: 
http://old.nabble.com/call-c%2B%2B-method-by-string-name-%2B-passing-parameters-tp27196409p27196499.html
Sent from the Gnu - Common C++ mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]