我已经在C#中编程了一段时间,现在我想要提高我的C++技能.
上课:
class Foo { const std::string& name_; ... };
什么是最好的方法(我只想允许对name_字段的读访问):
inline const std::string& name() const { return name_; }
谢谢.
c++ coding-style getter-setter
c++ ×1
coding-style ×1
getter-setter ×1