スレを勃てるまでもないC/C++の質問はここで 25 [隔離病棟]©2ch.net (467レス)
上下前次1-新
抽出解除 必死チェッカー(本家) (べ) レス栞 あぼーん
131(1): 2017/05/19(金)19:46 ID:BDF1+v1a(1/2) AAS
コピーコンストラクタのところでエラーがでます。
>オブジェクトにメンバー 関数 "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;
};
135: 2017/05/19(金)22:24 ID:BDF1+v1a(2/2) AAS
>>134
そういうこと
ありがとう
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 1.030s*