Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #11559
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: const and non const parameter passing |
| Date | 2011-11-17 23:24 +1300 |
| Message-ID | <9ik5nbFsoiU1@mid.individual.net> (permalink) |
| References | <33539597.678.1321525054013.JavaMail.geo-discussion-forums@prou19> |
On 11/17/11 11:17 PM, asit wrote:
> why the following code does not compile at line 14
>
> #include<iostream>
> #include<cstdlib>
>
> using namespace std;
>
> struct One
> {
> void funct1()
> {
> cout<<"Testing..."<<endl;
> }
> };
>
> void funct2( const One& c) //line 14
> {
> c.funct1();
It will fail here. funct1() is a non-const member function, c is a const
object.
--
Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
const and non const parameter passing asit <lipun4u@gmail.com> - 2011-11-17 02:17 -0800 Re: const and non const parameter passing Ian Collins <ian-news@hotmail.com> - 2011-11-17 23:24 +1300 Re: const and non const parameter passing asit <lipun4u@gmail.com> - 2011-11-17 02:20 -0800 Re: const and non const parameter passing Juha Nieminen <nospam@thanks.invalid> - 2011-11-17 17:09 +0000
csiph-web