Skip to main content
gamedev.net
🔒 Locked

my brAIN

Started by F-Kop 1 reply 450+ views
Original Post
F-Kop
F-Kop
i've been googling this, and i've found nothing. i recall seeing const used like this (either c or c++, not sure):

int func(void) const
{
    return 0;
}
what does that mean?
---------------------------------Upon thine ass shall I bust but a single cap.
choffstein
choffstein
A const object can use the function and gaurantee that its guts won't be changed.
That is, if it is a member function (which I assume it is).

Or something like that.
Sneftel
Sneftel
It means that the function (which is, BTW, a member function of a class) promises not to change the data in the instance of the class. Which means you can call it even if you have an instance of the class which you're not allowed to change. More info.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.