Say there are two classes, Base which contains certain parameters and D which contains more parameters. I need to make a variable with Base type then pass there type D which inherits from base.
class Base {
protected:
Base(const String& sFileName,
const String& filetype);
};
class D : public Base
{
public:
D(const String& sFileName,
const String& filetype, boost::shared_ptr<custom_type> requester)
};
int main()
{
//this works
return std::unique_ptr<Base>(new D(sFileName, filetype, requester));
//this does not
return std::make_unique<Base>(sFileName, filetype, requester);
}
does anyone know why the first return works but the second does not? It throws an error saying error: invalid new-expression of abstract class type Base
I tried converting the unique pointer with a New object into a make_unique and it threw errors