Skip to content

Commit

Permalink
常对象不能更新常成员变量
Browse files Browse the repository at this point in the history
  • Loading branch information
huihut committed Jun 21, 2019
1 parent b486932 commit 8678a9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public:
void function()
{
// 对象
A b; // 普通对象,可以调用全部成员函数
const A a; // 常对象,只能调用常成员函数、更新常成员变量
A b; // 普通对象,可以调用全部成员函数、更新常成员变量
const A a; // 常对象,只能调用常成员函数
const A *p = &a; // 常指针
const A &q = a; // 常引用

Expand Down
4 changes: 2 additions & 2 deletions README_Details.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public:
void function()
{
// 对象
A b; // 普通对象,可以调用全部成员函数
const A a; // 常对象,只能调用常成员函数、更新常成员变量
A b; // 普通对象,可以调用全部成员函数、更新常成员变量
const A a; // 常对象,只能调用常成员函数
const A *p = &a; // 常指针
const A &q = a; // 常引用

Expand Down

0 comments on commit 8678a9f

Please sign in to comment.