|
From: Tom H. <to...@co...> - 2013-09-30 08:07:38
|
On 30/09/13 08:59, Damien R wrote:
> Thanks to everyone who answered the question but I still do not
> understand why foo->print() does work. For me foo is part of the object
> because it is the object. Does it mean that the method print is
> generated like:
> void print(Foo *)
> {
> std::cout << "foo" << std::endl;
> }
Yes, basically that is exactly what happens. The function (with g++) is
actually called _ZN3Foo5printEv but other than that you have the details
exactly right.
> If this is the case, can someone give me some resources about the memory
> organisation of c++ and about class/methods generation?
Well strictly speaking those are implementation details which may vary
from one compiler to another, or at least from one platform to another.
Tom
--
Tom Hughes (to...@co...)
http://compton.nu/
|