Re: const int f() and int f() const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Suppose there is a function f() which returns an integer and does not
change
> any value of the class it belongs to, should I declare it as:
>
> const int f();
>
> or
>
> int f() const;

This one.

> What is the difference? Thank you.

The first one returns a 'const int.'
The second one is an immutable function.


-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux