Simple question about C++ constant syntax
- by WilliamLou
Here is some code copied from Thinking in C++ Vol1 Chapter 10.
#include <iostream>
using namespace std;
int x = 100;
class WithStatic {
static int x;
static int y;
public:
void print() const {
cout << "WithStatic::x = " << x << endl;
cout << "WithStatic::y = " << y << endl;
}
};
what's the meaning of const for the function print()? Thanks!