
1 Mar
2010
1 Mar
'10
9 p.m.
On 3/1/2010 2:10 PM, Christopher Jefferson wrote:
Presumably each "int" now has 2 member function pointers. Thus 4 bytes becomes 20 bytes (best case, 64 bit ptrs) and more on compilers that have bigger member function pointers.
What exactly do you mean?
In order for a property ("Age" in the original example) to be able to reference other properties/members of its containing class, it needs a pointer to the object containing it. But now that I re-read Daniel's message, maybe he's suggesting that you'd have to have: struct foo { int data; int (*getter)(); void (*setter)(int); }; which is certainly unnecessary if you're being smart with templates. - Jim