[lug] (OT) C++ ?, pointers to member functions

D. Stimits stimits at idcomm.com
Thu Aug 9 09:37:25 MDT 2001


"Scott A. Herod" wrote:
> 
> Tom Tromey wrote:
> >
> > For instance, if you have one library which implements a base class
> > with a virtual function f, and then another library which has a
> > class derived from `base' which overrides `f', then your program can
> > call `obj->f' without fear; it won't matter where the actual class of
> > `obj' is implemented.
> >
> 
> Tom,
> 
> To tie this with another C++ thread from a couple of weeks ago.  I guess
> that I would not expect objects built with different "packing" to be
> used together successfully.  ( I probably should check this with a
> simple test. )  Wouldn't changing how the compiler segmented memory
> for the layout of objects make vtables incompatable?

My own comment on this is that I wasn't expecting you to be mixing
compilers, or to directly manipulate vtables. But in the case of
anything declared virtual, it is the common characteristic of relative
offset that gives the ability to work with virtual replacements. Am I
incorrect when I assume you are using member method pointers under a
single compiler and platform (rather than mixing)?

D. Stimits, stimits at idcomm.com

> 
> Scott
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list