Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #15257
| From | Bo Persson <bop@gmb.dk> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Question on Basic Function Syntax |
| Date | 2012-04-09 14:22 +0200 |
| Message-ID | <9ug2k4Fav9U1@mid.individual.net> (permalink) |
| References | <d8d21a09-f8b8-4644-8967-8095ee1c6eca@f27g2000yqc.googlegroups.com> <e0dfbedf-9308-48b4-ac89-3ce8d63497a1@h12g2000yqi.googlegroups.com> |
Paul N skrev 2012-04-08 21:42:
> On Apr 8, 8:40 pm, Danny Gratzer<danny.grat...@gmail.com> wrote:
>> Hello,
>> I have been reading my way through C++ Primer and I noticed that the
>> function prototype for one of the functions resembled this
>>
>> class A{
>>
>> public:
>> void f(const int& a) const;
>> ...
>>
>> };
>>
>> what is the purpose of that second const following f's parameters?
>>
>> thanks in advance.
>
> It means that calling the function doesn't alter the object that it is
> called on.
Which also allows you to call the function for constant objects.
Bo Persson
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
Question on Basic Function Syntax Danny Gratzer <danny.gratzer@gmail.com> - 2012-04-08 12:40 -0700
Re: Question on Basic Function Syntax Paul N <gw7rib@aol.com> - 2012-04-08 12:42 -0700
"f() const;", defined inside a struct ( i.e. a "class" ). @Jeff-Relf.Me - 2012-04-08 12:56 -0700
Re: "f() const;", defined inside a struct ( i.e. a "class" ). danny.gratzer@gmail.com - 2012-04-08 13:11 -0700
Re: "f() const;", defined inside a struct ( i.e. a "class" ). Rui Maciel <rui.maciel@gmail.com> - 2012-04-08 22:22 +0100
Re: "f() const;", defined inside a struct ( i.e. a "class" ). danny.gratzer@gmail.com - 2012-04-08 13:04 -0700
Re: "f() const;", defined inside a struct ( i.e. a "class" ). Victor Bazarov <v.bazarov@comcast.invalid> - 2012-04-08 16:46 -0400
Re: "f() const;", defined inside a struct ( i.e. a "class" ). Marc <marc.glisse@gmail.com> - 2012-04-08 21:03 +0000
Re: "f() const;", defined inside a struct ( i.e. a "class" ). "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-04-08 23:35 +0200
Re: "f() const;", defined inside a struct ( i.e. a "class" ). nick_keighley_nospam@hotmail.com - 2012-04-10 04:05 -0700
Re: Question on Basic Function Syntax Juha Nieminen <nospam@thanks.invalid> - 2012-04-09 08:03 +0000
Re: Question on Basic Function Syntax Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-10 14:12 +0000
Re: Question on Basic Function Syntax Juha Nieminen <nospam@thanks.invalid> - 2012-04-10 14:30 +0000
Re: Question on Basic Function Syntax Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-10 21:57 +0000
Re: Question on Basic Function Syntax Bo Persson <bop@gmb.dk> - 2012-04-09 14:22 +0200
csiph-web