473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

declaration of `const AreaSet &CObeyFile::AreaSet () Declaration of "const A &B::A() const" changes meaning of A from "class A"

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++.

Thank you for any hints!
Alex

Jul 23 '05 #1
3 1818
Alexander Farber wrote:
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++.


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

Jul 23 '05 #2
Alexander Farber wrote:
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


Your function is called AreaSet, just the same as the class.

Jul 23 '05 #3
Hi,

Rolf Magnus wrote:
Alexander Farber wrote:
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


Your function is called AreaSet, just the same as the class.


but it is a member function (of the class CObeyFile) isn't it?
I still don't understand, why their names clash

Regards
Alex

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Anon Email | last post by:
Hey people, This looks really weird. I can't make sense of it. Is this a mistake? Can anyone help? IStack const & GetStack () const; Cheers,
1
by: elviin | last post by:
Hello. I'd like to know what means const() in the following declaration T & operator(std::ptrdiff_t i) const() const; I've been looking on http://boost.org/libs/smart_ptr/shared_array.htm
6
by: kelvSYC | last post by:
This little bit of seeminly innocent code seems to give me these two errors, all on the line that declares check(). Is there some part of C++ that I'm missing out on? class Condition { public:...
5
by: vilhelm.sjoberg | last post by:
Hello, I am a resonably confident C programmer, but not very sure about the dark corners of C++. Recently, I had G++ give me a strange error. The program in question is in essence: struct...
18
by: hzmonte | last post by:
typedef int t_compare_func(const void *, const void *); struct node *tree_search(struct node *root, const void *keyy, t_compare_func *comp) { struct node *cur_item; int result; if (root ==...
2
by: Alex Sedow | last post by:
Why interface-event-declaration does not support multiple declarators like event-declaration? Grammar from C# spec: variable-declarators: variable-declarator variable-declarators ","...
2
by: Jason Heyes | last post by:
Are these two lines equivalent? const int x = 3; const x = 3; Thanks.
5
by: Owen Ransen | last post by:
When I installed the new VC 2005 I though, aha at last I will be able initialise static const members in the H file, and I can, but only integer types. double types have to be declared in the H...
4
by: =?utf-8?b?QXNiasO4cm4gU8OmYsO4?= | last post by:
Suppose I have a function that takes a pointer as its input, but does not change what the pointer points to. In that case, the const qualifier can be used to indicate that the variable pointed to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.