Message-ID: <3787A70E.190417A@unb.ca> From: Endlisnis 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. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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