function() const {};
Hello,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#include <iostream>
using namespace std;
class MyClass {
mutable int i;
int j;
public:
int geti() const {
return i; // ok
}
void seti(int x) const {
i = x; // now, OK.
}
};
int main()
{
MyClass ob;
ob.seti(1900);
cout << ob.geti();
return 0;
}
|
What can you use the const for at a function?
Thank you.
Thank you very much. Now I understand:)
Topic archived. No new replies allowed.