17/05/19 19:46:36.77 BDF1+v1a.net
コピーコンストラクタのところでエラーがでます。
>オブジェクトにメンバー 関数 "A::getFileName" と互換性のない型修飾子があります
>C2662 'const std::string &A::getFileName(void)': 'const A' から 'A &' へ 'this' ポインターを変換できません。
どう直せばいいのですか?
class A {
public:
A() {}
A(const A &a) {
this->setFileName(a.getFileName()); //ここでエラー
}
void setFileName(const std::string& fn) {
this->m_fileName = fn;
}
const std::string& getFileName() {
return this->m_fileName;
}
private:
std::string m_fileName;
};