Re: Problem with covariant return types
From: Rob. (robert_at_xxx.fi)
Date: 06/25/04
- Next message: David Lowndes: "Re: dialog box initialization"
- Previous message: Gary Nastrasio: "Big Problem With Mouse Hook"
- In reply to: Victor Bazarov: "Re: Problem with covariant return types"
- Next in thread: Igor Tandetnik: "Re: Problem with covariant return types"
- Reply: Igor Tandetnik: "Re: Problem with covariant return types"
- Reply: Victor Bazarov: "Re: Problem with covariant return types"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 26 Jun 2004 01:00:06 +0300
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in message
news:ubg4IQvWEHA.3340@TK2MSFTNGP10.phx.gbl...
> Rob. wrote:
> > The following code won't compile (error C2555: 'B::f': overriding
virtual
> > function return type differs and is not covariant from 'A::f') unless I
> > moved the definitions of X and Y to before the definitions of A and B
> > respectively. Now I can understand that the compiler doesn't know that Y
is
> > derived from X when parsing B but at the very least this is a very
confusing
> > error message and I'm not sure it shouldn't be accepted.
>
> Huh? "Type differs and is not covariant" cannot be more concise and to
> the point. If you think it's "confusing", could you _please_ provide
> the message you think it should give? Thanks.
My suggestion would be:
"Cannot use covariant return types when types/classes have not been
defined"
The compiler quite clearly knows that the classes have not been defined so
why should it assume they are not covariant? It's the same situation as
trying to instantiate an undefined class.
Rob.
- Next message: David Lowndes: "Re: dialog box initialization"
- Previous message: Gary Nastrasio: "Big Problem With Mouse Hook"
- In reply to: Victor Bazarov: "Re: Problem with covariant return types"
- Next in thread: Igor Tandetnik: "Re: Problem with covariant return types"
- Reply: Igor Tandetnik: "Re: Problem with covariant return types"
- Reply: Victor Bazarov: "Re: Problem with covariant return types"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|