全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Const member function, const-correctness?

又称: const member function · const-correctness

Definition 1.9 University Computer Science — Year 2 · 第 1 章 — From C to C++: Classes and Resource Management

A member function declared with const after its parameter list is a const member function: it may not change the object’s data members, and it is the only kind of member function that can be called on a const object or through a const reference. A program is const-correct when every function that does not change an object takes it as const, and every member function that does not change its object is const.

在原文中阅读 →