member functions are not stored anywhere. their definitions are stored in the binary/executable. when you compile/link at that time the binding of the addresses takes place. so the calling function has the address thats it. taking your example:
1 2 3 4 5 6 7 8 9
|
class A
{
int a
public:
get_a() //definations are generated in binary, lets say it is stored at address
{} //0x1000
set_a() //lets say this is stored at address 0x2000
{}
};
| |
void main()
{
A a; //here it will take 4bytes
now if you call any function then
the code flow has the address of the called function
a.set_a(); //this will bind to 0x2000 during compilation/linking
/**
when this code point is reached during binary execution,
code will start to execute from address 2000
actually these address are resolved when the binary is loaded in the memory.
i may not be very clear, hope you might get what im saying
*/
so function address doesnt needs to be stored in class object
}