In C++, I have a parent function whose return type is folly::Optional<int>
. My question is: Can we override the function and return int
in the derived function?
I know this is doable in Java. For C++, I searched for some documents and saw that C++ allows covariant return type for overriding function. But I didn't find if optional/non-optional is a case of covariant return type.