Re: 'virtual' can only be used....
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: Tue, 25 May 2004 15:39:24 -0400
>>Write it as
>> virtual Rectangle const& getNameDisplayRect(int) const = 0;
>>(your first 'const' is in the wrong place)
> Thanks for your response. Unfortunately, this change didn't help.
> As a side note, are you sure the way I have it is wrong? I thought
> that "Rectangle& const" means "A reference which cannot be changed
> that refers to a rectangle" whereas "Rectangle const&" means "A
> reference (which can be changed) that refers to a Rectangle which
> cannot be changed". Thus both are legal. Am I wrong here?
References cannot be changed (according to their nature) and therefore
cannot be cv-qualified. The standard explicitly prohibits qualifiers
>>Another guess is that 'Rectangle' is somehow
>>a macro that has some template thing in it, and you don't know of
>>it because the actual "Rectangle.h" file being included is not
>>the one you provided, but some system file from some other package
>>(happened to me once with a header named "data.h" -- very original
>>name, isn't it?)
> This isn't the case, either. Rectangle.h is a file I wrote, it's an
> extremely simple class with no macros.
> Any other ideas?
Begin eliminating stuff from your program until it compiles. Thus you
will isolate the offending part. Then create a small test program with
it and see if you got it right. If after that you still don't see the
reason why the compiler is complaining, post the small test program and
we can discuss it.