正在加载图片...
10.2 const(Constant)Objects and const Member functions常成员函数 目的:通过把成员函数声明为 const,以表明它们 不修改类的成员变量 常成员函数(两处都要声明) o prototype void printUniversalO const o definition. void Time: printUniversal0 const (. J 要求: °不能修改本对象的数据成员 °不能调用本对象其它non-cons成员函数 O 2015, SEU. All rights reserved. 7© 2009, SEU. All rights reserved. © 2015, SEU. All rights reserved. 7 10.2 const (Constant) Objects and const Member Functions—常成员函数 目的:通过把成员函数声明为const,以表明它们 不修改类的成员变量 常成员函数(两处都要声明) prototype: void printUniversal() const; definition: void Time::printUniversal() const { … } 要求: 不能修改本对象的数据成员 不能调用本对象其它non-const成员函数
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有