我正在做一个包含两个类的项目:Evidence and Image(Evidence之子)
证据的构造函数是:
Evidence(A* a, B* b, C* c);
继承类Image的构造函数是:
Image(A* a, B* b, C* c): Evidence(a,b,c){... code...}
编译器抛出以下错误:
In file included from src/evidence/Image.cpp:8:
src/evidence/Image.h:22: error: no matching function for call to
'Evidence::Evidence(A*&, B*&, C*&)'
src/evidence/Evidence.h:35: note: candidates are: Evidence::Evidence(A*, B*, C*)
src/evidence/Evidence.h:21: note: Evidence::Evidence(const Evidence&)
有什么问题?我很困惑,我伤害了自己。
答案 0 :(得分:0)
你宣布你的Evidence
构造函数,但你实际上并没有定义它。
替换:
Evidence(A* a, B* b, C* c);
使用:
Evidence(A* a, B* b, C* c) {}