为什么静态成员函数不能申请为const?

静态成员函数是属于类的bai,而不是某个具体对象,

在没du有具体对象的时候zhi静态成员就已经存在,静态成员函数不会访问到非静态成员,也不存在this指针。

而成员函数的const就是修饰this指针的,既然静态成员函数不会被传递this指针,那const自然就没有必要了

猜你喜欢

转载自blog.csdn.net/haimianjie2012/article/details/109031266