C ++ and links

I am currently working on a project that has several files and is a bit more complicated (in terms of maintaining inheritance rights). I am getting a compilation error, and I think this has something to do with links. Here is the error I get at compile time

videotodatastream.cpp: In member functionvirtual void Wade::VideoToDataStream::getData(std::string&)’:
    videotodatastream.cpp:33: error: no matching function for call toWade::VideoWrapper::getVideo(Letscher::Video (&)())’
    videowrapper.h:10: note: candidates are: virtual void Wade::VideoWrapper::getVideo(Letscher::Video&)

Here is the line he complains about

Letscher::Video vid();
_vid.getVideo(vid); //Problem line

_vid is the private data of an element of type VideoWrapper &

VideoWrapper& _vid;

VideoWrapper is a pure virtual base class with the following methods:

class VideoWrapper {
    public:
        virtual void setVideo(Letscher::Video& video) = 0;
        virtual void getVideo(Letscher::Video& video) = 0;    
}; 

The VideoWrapper child class that I actually use is RawVideo , and it looks like

class RawVideo : public VideoWrapper {
    public:
        RawVideo(Letscher::Video& video);
        virtual void setVideo(Letscher::Video& video);
        virtual void getVideo(Letscher::Video& video);

    private:
        Letscher::Video* _vid;
};

Wade::RawVideo::RawVideo(Letscher::Video& video): _vid(&video) {
}

void Wade::RawVideo::setVideo(Letscher::Video& video) {
  *_vid = video;
}

void Wade::RawVideo::getVideo(Letscher::Video& video) {
  video = *_vid;
}

, _vid.getVideo(vid), , vid RawVideo. - , , .

, .

+3
3

Letscher::Video vid(); vid. vid, a Letscher::Video.

, Letscher::Video vid;.

+7

Letscher::Video vid(); vexing. vid, Letscher::Video . .

+4

Find the most annoying C ++ simulator on the net. You are not creating any object, instead you are declaring a function prototype.

+2
source

Source: https://habr.com/ru/post/1779644/


All Articles