EGCS: pointer to member functions.
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Tue Jun 15 23:27:00 GMT 1999
> Thanks, I think you've convinced me it might not be too hard to do
> this.
So easily convinced? :-) So what about assignment of
pointer-to-member?
struct FOO
{ public :
virtual void f1();
};
extern FOO foo;
void (FOO::*fp)();
struct dummy{int i;};
struct S:dummy,FOO{
virtual void f1();
};
void (S::*x)();
int bar()
{
S *s = new S;
FOO *foo = s;
fp = &FOO::f1;
(s->*fp)(); // Thunk expects vtable at offset 0
x=fp;
(s->*x)(); // vtable is at offset 4
}
Regards,
Martin
More information about the Gcc
mailing list