HI guys, I am trying to get the address of a member function in a class and store it a void pointer within the class. How do i do that?
|
C
How do i get the address of a member function from inside a class? |
|
maybe this could help. I didn't actually read it over but it sounds similar.
http://stackoverflow.com/questions/12988...r-function (Mar 16, 2017 08:47 PM)aeiro Wrote: maybe this could help. I didn't actually read it over but it sounds similar. Well, thats not exactly the thing i was looking for, but i got my answer from stackexchange. It seems you can get the address of a member function like this....... void * a; a = &A::func(); This gets the address of func from within class A. So yeah, my problem was solved.
Mar 17, 2017 09:40 AM
(This post was last modified: Mar 17, 2017 10:05 AM by Goodies.)
Well, you kind of can't.
http://www.dietmar-kuehl.de/mirror/c++-f...l#faq-33.7 What are you trying to do? The general way of getting a member function is by typedefing a member function pointer (or using auto if you're brave enough). PHP Code There's probably a better way of doing whatever you're trying to do... like, for example, std::function. This would be way better. PHP Code or lambdas <3 PHP Code SRPP Discord Server
I am a professional network/cloud security architect. My Old Tutorials |
|
|


![[Image: 5Iq5rDJ.gif]](https://i.imgur.com/5Iq5rDJ.gif)
