| re: declaration of `const AreaSet &CObeyFile::AreaSet () Declaration of "const A &B::A() const" changes meaning of A from "class A"
Alexander Farber wrote:[color=blue]
> Hi,
>
> does anyone have an idea, why do I get the following error
> (I have to use g++296 on RedHat Linux as compiler):
>
> In file included from r_dir.cpp:9:
> r_obey.h:262: declaration of
> `const AreaSet &CObeyFile::AreaSet () const'
> r_areaset.h:197: changes meaning of `AreaSet' from `class AreaSet'
>
> The afore-mentioned line in r_obey.h is:
>
> class CObeyFile
> {
> private:
> AreaSet iAreaSet;
>
> public:
> const AreaSet& AreaSet() const; // line 262
>
> And the line in r_areaset.h is:
>
> class AreaSet
> { // line 197
> public:
> AreaSet();
> ~AreaSet();
>
> Same code compiles fine with MS VC++.[/color]
Well, in r_areaset.h, 'AreaSet' is a class. Then, in r_obey.h, you try
to redeclare it as a function. You can't do that. The easy solution
is to rename the function to something like GetAreaSet().
Kristo |