| cvs.gedasymbols.org/archives/browse.cgi | search |
| Message-ID: | <3787A70E.190417A@unb.ca> |
| From: | Endlisnis <s257m AT unb DOT ca> |
| Organization: | Nortel Networks |
| X-Mailer: | Mozilla 4.51 [en] (Win98; U) |
| X-Accept-Language: | en |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | const class& as a parameter. |
| Lines: | 22 |
| Date: | Sat, 10 Jul 1999 20:02:13 GMT |
| NNTP-Posting-Host: | 209.226.124.243 |
| X-Trace: | news20.bellglobal.com 931636933 209.226.124.243 (Sat, 10 Jul 1999 16:02:13 EDT) |
| NNTP-Posting-Date: | Sat, 10 Jul 1999 16:02:13 EDT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
I have some class "foo":
class foo {...};
And I have some function bar:
void bar(const foo& foo2)
{
foo2.member();
}
This generates a "warning: passing `const foo' as `this' argument of `void
foo::member()' discards const".
Does this mean that I can't call any member functions of a class which is
passed as a const-reference without risking modification of the class data? I
could just remove the 'const', but I did it to prevent other warning messages
like if I were to call "bar((foo)5)".
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT HotMail DOT com
ICQ: 32959047
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |