我目前正在开发一个包含多个文件的项目,并且有点复杂(在保持继承权方面).我收到编译错误,我认为它与引用有关.这是我在编译时遇到的错误
videotodatastream.cpp: In member function ‘virtual void Wade::VideoToDataStream::getData(std::string&)’:
videotodatastream.cpp:33: error: no matching function for call to ‘Wade::VideoWrapper::getVideo(Letscher::Video (&)())’
videowrapper.h:10: note: candidates are: virtual void Wade::VideoWrapper::getVideo(Letscher::Video&)
Run Code Online (Sandbox Code Playgroud)
这是它抱怨的路线
Letscher::Video vid();
_vid.getVideo(vid); //Problem line
Run Code Online (Sandbox Code Playgroud)
_vid是VideoWrapper&类型的私人会员数据
VideoWrapper& _vid;
Run Code Online (Sandbox Code Playgroud)
VideoWrapper是一个纯虚拟基类,具有以下方法:
class VideoWrapper {
public:
virtual void setVideo(Letscher::Video& video) = 0;
virtual void getVideo(Letscher::Video& video) = 0;
};
Run Code Online (Sandbox Code Playgroud)
我实际使用的VideoWrapper的子类是RawVideo,它看起来像这样
class RawVideo : public VideoWrapper {
public:
RawVideo(Letscher::Video& video);
virtual void setVideo(Letscher::Video& video);
virtual void getVideo(Letscher::Video& video);
private:
Letscher::Video* …Run Code Online (Sandbox Code Playgroud)