| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
| From: | Karl Heinz Buchegger <kbuchegg AT gascad DOT at> |
| Newsgroups: | comp.os.msdos.djgpp,comp.lang.c++ |
| Subject: | Re: Passing 'const' as 'this' discards qualifiers |
| Date: | Tue, 04 Dec 2001 17:14:49 +0100 |
| Organization: | GASCAD |
| Lines: | 34 |
| Message-ID: | <3C0CF679.D0A24FB8@gascad.at> |
| References: | <3C0CCEE3 DOT A2D60376 AT bigfoot DOT com> <3C0CD55F DOT B04E8089 AT gascad DOT at> <3C0CD695 DOT 7F408020 AT bigfoot DOT com> |
| NNTP-Posting-Host: | 62.46.205.68 |
| Mime-Version: | 1.0 |
| X-Trace: | fu-berlin.de 1007482386 9108164 62.46.205.68 (16 [95537]) |
| X-Mailer: | Mozilla 4.5 [en] (WinNT; I) |
| X-Accept-Language: | en |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Alex Vinokur wrote:
>
> Karl Heinz Buchegger wrote:
>
> > Alex Vinokur wrote:
> > >
> >
> > > public:
> > > bool operator() (AAA& ins1, AAA& ins2) const {return false;}
> > *****
> >
>
> operator() on my program doesn't contain const :
I know, but it should. At least this is what your compilers
error message means in plain english:
> ttt.c:20: passing `const AAA' as `this' argument of `void AAA::foo1()'
> discards qualifiers
means
"You try to call a non-const function for a const object"
Oh sorry. Just figured out that the error message doesn't talk
about the operator altogether. Instead you somewhere try
to call a function fool(). But the cure is the same. Make
foo() a const member function.
--
Karl Heinz Buchegger
kbuchegg AT gascad DOT at
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |