次の例を考えてみましょう:
class MyClass
{
// Getters by copy ?
public:
inline std::string fullName() const {return _firstName+_lastName;}
// Getters by reference ?
public:
inline const std::string& firstName() const {return _firstName;}
inline const std::string& lastName() const {return _lastName;}
// Data members
protected:
std::string _firstName;
std:::string _lastName;
}
コードのドキュメントでは、参照によるゲッター (クラス データ メンバーへの直接アクセス) とコピーによるゲッター (クラス データ メンバーで構築されたデータへのアクセス) を区別したいと思います。この 2 つの異なるカテゴリに名前を付けるには、どのような言葉を使用できますか?