只能在类中使用const成员函数。
class A {
public:
void test() const {
cout << "123" << endl;
};
};
int main()
{
A a;
a.test();
return 0;
}
只能在类中使用const成员函数。
class A {
public:
void test() const {
cout << "123" << endl;
};
};
int main()
{
A a;
a.test();
return 0;
}