class Child: public Base {.....}
class Child
{
static std::optional<Base>& Child::GetBaseInstance()
{
static std::optional<Base> instance = std::make_optional<Chid>; \\Does not work. Please help
return instance;
}
}
I'm trying to return an instance but of type of std::optional of it's base. Also should I be returning std::optional& or std::optional<Base&> if I'm trying to pass the same reference?