只有const成员函数,无const非成员函数。因为普通函数通过将调用参数设定为const防止函数内修改。解释
Const成员函数
类成员函数 const放在后面,声明定义都要加。

只要类方法不修改调用对象,就应声明为const

const其他知识

左定值,右定向
https://www.cnblogs.com/2018shawn/p/10853607.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-03-05
  • 2021-11-05
  • 2021-07-21
  • 2021-06-09
猜你喜欢
  • 2021-07-01
  • 2021-10-03
  • 2021-09-04
相关资源
相似解决方案