正在加载图片...
10.2 const(Constant)Objects and const Member Functions void Time: test(Time &another) const minute 20 /不能修改 object printstandardo万 ∥/不能调用non- const成员函数 another minute= 20. ∥/oK,非同一 object another. sethour 6: ∥/oK 2015, SEU. All rights reserved. 10© 2009, SEU. All rights reserved. © 2015, SEU. All rights reserved. 10 10.2 const (Constant) Objects and const Member Functions void Time::test(Time &another) const { minute = 20; // 不能修改object printStandard(); // 不能调用non-const成员函数 another.minute = 20; // OK,非同一object another.setHour(6); // OK }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有