M
moongeegee
what does it mean/purpose ?
class xxx
{
}
class xxx
{
}
Sent by mistake.
What does the "const" mean/purpose ?? Thanks
class xxx
{
double getNum() const;
}
Victor Bazarov said:You seem to imply that for a non-const instance of 'xxx'
'getNum' cannot be called.
That's not true.
moongeegee a écrit :
it means that, is you have a const instance of the class xxx,
you will be able to call getNum on it:
const xxx theXXX;
double d = theXXX.getNum();
When you declare a member function as const, the compiler
check that the function does not modify the object it is
called on.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.