Recently learned the principle of plug, mainly some memory operation. And then I found one in the process--the address of a class member function seems to get out of the class directly (except for static functions).
I've found an ingenious way to get a class member function address with a consortium
Template<typename dst_type,typename src_type>
dst_type union_cast (src_type src)
{
union{
src _type s;
Dst_type D;
} u;
U.S = src;
return u.d;
}
This is a type conversion function
You can call this:
typedef void (A::* Good) (void);
typedef void (*golobal) (void);
Cout<<union_cast<golobal,good> (&a::good);
This will allow the global address to be obtained. can use OD to open look at the output of the address location is what instructions, open OD can find this address is such an instruction jmp XXXXX
And that piece of instruction is this, not difficult to guess is the function of the Address table. Although this is the callable address of the function, it is not the real address of the function.
~ ~~~~~~~ Editor ~ ~~~~~~~~~~~
I later found out that this was the real address with release version. If it's a debug version, you'll get a lot of debugging information.