类函数修饰 const

1、类成员函数访问修饰const,申明和定义中须保持一致;

class IntCell{... ; int read( ) const;...}

int IntCell::read( ) const  { return storedValue }

 

posted @ 2019-04-11 17:34  kuaqi  阅读(151)  评论(0)    收藏  举报