From: Nevin :-] Liber on
In article <rwP27UG+gjuLFwQn(a)J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>,
John G Harris <news0(a)nospam.demon.co.uk> wrote:

> >class IAbstract
> >{
> > public:
> > virtual int MethodA() const = 0;
> >};
> The const qualifier guarantees that next time you do x.MethodA() you
> will get the same answer if you've done nothing else to x in the
> meantime.

Nope. for instance:

class Concrete : IAbstract
{
virtual int MethodA() const
{ static int i; return ++i; }
};

Const in this case is for the programmer to say that he is not intending the logical state of the instance to change via that method. While the guarantee isn't any stronger than this, in practice it is still very useful.

--
Nevin ":-)" Liber <mailto:nevin(a)eviloverlord.com> 773 961-1620

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]