Thursday, 24 May 2007

Resolving function address ...

The question is, if we are calling a function 'void function()' from 'main()', how the call is actually made?

We know the answer, it will be just a jump instruction to a particular address where the function instruction set starts.

How the member function address resolved in C++?

We all know member function is not stored as part of the class. It will be stored outside somewhere (code segment?). Then how is the call made when we say 'obj.function()'?

The answer is simple, actual call made would be like 'function(&obj)'. Thereby it will be just a simple jump instruction as we saw earlier.

No comments: