Re: Calling C++ functions



William L. Thomson Jr. wrote:
I am having problems calling C++ functions from my GTK buttons.

No, you want to call class members. C++ functions don't differ from C functions.
Thanks


You know, that a class member function is not the same as a global function? There is a standard argument to every class member function:
The this pointer.

class Foo
{
        char Bar(int foobar);
};

A class member function pointer type of Foo::Bar(...) is e.g.

char (Foo::*pBar)(int)=&Foo::Bar;

You see, that this has another type than a G_Callback, even if it has the same parameter list, since the compiler internally makes something like

char Bar Foo(Foo*, int);

from it.

--
+------------------------------------------------+
| +----------------+ WOLFGANG DRAXINGER          |
| | ,-.   DARKSTAR | lead programmer             |
| |(   ) +---------+ wdraxinger darkstargames de |
| | `-' / GAMES /                                |
| +----+''''''''     http://www.darkstargames.de |
+------------------------------------------------+




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