const对象不能改变数据成员,所以不能调用非const函数;比如:
class Oneclass{
public:
void ctfunc() const{}
void uctfunc() {}
}
int onefunc(const Oneclass obj,const Oneclass *pointer,const Oneclass &reference){
obj.uctfunc(); //ok
pointer->uctfunc(); //ok
reference.ctfunc(); //ok
obj.ctfunc(); //error
pointer->ctfunc(); //error
reference.ctfunc(); //error
return 0;
}