This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: glossary for egcs - request for contributions
- To: oliva at dcc dot unicamp dot br (Alexandre Oliva)
- Subject: Re: glossary for egcs - request for contributions
- From: Joe Buck <jbuck at Synopsys dot COM>
- Date: Thu, 29 Apr 99 3:24:54 PDT
- Cc: jbuck at Synopsys dot COM, espie at quatramaran dot ens dot fr, egcs at egcs dot cygnus dot com
> > 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. :-)