From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Oliva To: Joe Buck Cc: espie@quatramaran.ens.fr (Marc Espie), egcs@egcs.cygnus.com Subject: Re: glossary for egcs - request for contributions Date: Thu, 29 Apr 1999 00:12:00 -0000 Message-id: References: <199904290648.XAA11732@atrus.synopsys.com> X-SW-Source: 1999-04/msg01030.html On Apr 29, 1999, Joe Buck 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Oliva To: Joe Buck Cc: espie@quatramaran.ens.fr (Marc Espie), egcs@egcs.cygnus.com Subject: Re: glossary for egcs - request for contributions Date: Fri, 30 Apr 1999 23:15:00 -0000 Message-ID: References: <199904290648.XAA11732@atrus.synopsys.com> X-SW-Source: 1999-04n/msg01039.html Message-ID: <19990430231500.pTL0pUr3EeFK4rrpkHGTXygOp5qQnCapApTjll2TwuU@z> On Apr 29, 1999, Joe Buck 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