Home

minseokoh@hanafos.com wrote:
> Could someone explain why "const" is located after the function name
> and what it means?
>
> inline unsigned char *access(int off) const {
> if (off < 0)
> abort();
> return (&bits_[off]);
> }

Doesn't your favourite C++ book explain that? What book are you
reading that doesn't? I am specifically asking so that I can put
it in my black list of the never-recommend-those books.

'const' refers to the object for which it is called. Inside that
function 'this' pointer has the type 'T const * const' (as opposed
to the regular 'T * const').

Also, note that the keyword 'inline' is superfluous if the function
is defined inside the class definition (as it apparently is, here).

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

previous
next

Re: Video: WTC Witnesses: "It was definitely no commercial airliner"
What is a good way of having several versions of a python moduleinstalled in parallell?
Re: Maximum Accepted Layers/Levels of inheritance
Re: is it possible to switch between threads manually.
imaplib & Received: header(s)???
Niechciane i Zapomniane
Nasze Dzieci
Kidprotect
Akogo
Fundacja Sloneczko