The former returns a constant int. The latter const means that func2 cannot change the object that calls it.
So, if const is before the function, that means the function is returning a constant. If const is after the function, that means the function cannot change the object that calls it.

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

"If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

with your remarks since const after the function means the function itself cannot change the object that calls it, this format should be applied only for class member function right ? and is it possible for us to declare a member function with both consts before and after ? just like this:

Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Yes, const after a function is only for member functions of classes. And yes, you could have const both before and after. Doing so means that the function returns a constant and cannot change the object that calls it.

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

"If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

Yes, const after a function is only for member functions of classes. And yes, you could have const both before and after. Doing so means that the function returns a constant and cannot change the object that calls it.

What about this?
How does that differ from if the function returned a const int? You can't assign a value to a function in that way.

You (can) never assign values to a function, rather to the object returned by the function. The return values can be temporary objects (if returned by value), however, you can also return references or pointers to objects, through which you can access e.g. a class's members.

I'd have some remarks:
1.) returning references or pointers to local objects - which are destroyed after exiting the function's scope - is a very bad idea, as you're pointing to something that has been already destroyed

2.) member functions which return references to members less accessible then themselves is not an error, but should be applied only when really wanted and needed

The following example is a very simply one, and does not respect the above mentioned poit 2.) It's just to show the idea of l_value and r_value: