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


> > 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!  :-)

Alexandre is right, I was wrong, the C++ language is wrong.  (That is,
they should have permitted contravariance for regular function pointers,
not just member function pointers).

> 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;

Correct.  Let's pretend I wrote that. :-)


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