I am not a C++ guy, but I am trying to learn. I do not really know the lingo, so I am not sure what to search for, or how to ask this question. The best I can do is present the following example:
Define a generic class:
class IPlugin
{
public:
virtual void go(const Image &src, Image &dst) = 0;
}
and then two 'plugins'
class pluginDenoise : public IPlugin
{
public:
virtual void go(const Image &src, Image &dst)
{
denoise(src, dst);
}
}
class pluginDeblur : public IPlugin
{
public:
virtual void go(const Image &src, Image &dst)
{
deblur(src, dst);
}
}
I now want to define a general framework, such as:
class Processor
{
public:
Processor(IPlugin &unknown_plugin)
{
Image src = imRead("inpImage.jpg");
Image dst;
unknown_plugin.go(src, dst);
imWrite(dst, "outImage.jpg");
}
}
and from the main code, I want to call it something like
int main()
{
pluginDeblur d;
Processor p(d);
}
I understand this code will not compile... What is this even called? Is this possible?