This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: glossary for egcs - request for contributions


On Apr 29, 1999, Joe Buck <jbuck@Synopsys.COM> wrote:

> one may replace a class by a derived class.  e.g. I can overload a virtual
                                                              ^^^^
make that override

> 	typedef int (*PFDerived)(Derived&);
> 	int bfunc(Base&);
> 	PFDerived p = &bfunc;

> this is legal

No way!  :-)

You can't touch types of arguments when casting function types.  This
mechanism only works for pointers-to-members:

struct Base { void foo(); };
struct Derived : Base {};
typedef void (Derived::*PFDerived)();
PFDerived pD = &Base::foo;

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]