ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Non static member functions of a class cannot be called without using an object of that class.
So the address of such a function is not the same data type as the address of an ordinary function whose signature looks the same.
If you don't want to involve an object of the class, then you can make the functions static class members, then the data type of the address of the function would be the same as the data type as that of an ordinary (non member) function with the same signature.
If you do want to involve an object of the class, things get a bit more complicated. You would need to think through the desired behavior before it would make any sense to start digging into the tricky syntax of bind member function.
Thanks for your reply (I have thanked, even though it doesn't seem to work for me)...
I did try the static method before posting but it didn't work, I kept on getting the same errors. After your post I tried statics again (using above demo) and hey it worked, so I expanded out into properly defined classes (h + cpp) and I got the errors again...
After a little more searching I see that you don't use the static keyword on the function body, only the declaration.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.