Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Can anybody explain this snippet for me?

Reply
Thread Tools

Can anybody explain this snippet for me?

 
 
webinfinite@gmail.com
Guest
Posts: n/a
 
      10-22-2007
HI,

I ran across a code written by somebody else. Since I am new to C++,
could you please explain what each of "const *" means in this code
snippet as well as the last "const"?

Tool const* const* tool_array() const;

Tool is an internal structure defined somewhere else. tool_array()
gets an entire array of Tool type.


Thank you.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      10-22-2007
wrote:
> I ran across a code written by somebody else. Since I am new to C++,
> could you please explain what each of "const *" means in this code
> snippet as well as the last "const"?
>
> Tool const* const* tool_array() const;
>
> Tool is an internal structure defined somewhere else. tool_array()
> gets an entire array of Tool type.


The function 'tool_array' is a non-static member function of some
class. It returns a pointer to a constant pointer to a constant
object of type Tool (those are the two 'const' between 'Tool' and
the name of the function), and does not change the object for which
it is called (that's the 'const' after the [empty] argument list):
it can be called for a constant object.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
explain the code snippet Ajinkya C Programming 8 05-14-2007 10:35 AM
Can anybody explain this? (InProc Session locking broken) =?Utf-8?B?Tmljaw==?= ASP .Net 2 01-11-2006 09:33 AM
Can anybody explain.... David Wood Computer Support 11 10-18-2003 02:36 AM
Re: Can someone explain this snippet? Muenchian sorting. Marrow XML 2 07-07-2003 05:06 PM
Re: Can someone explain this snippet? Muenchian sorting. Colin Mackenzie XML 0 07-03-2003 03:45 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57