You can return only those value from a function which are same as the return type or can be implicitly converted to the return type.
In your example, the object can be implicitly converted to its superclass type.
Look at this example
public int
test()
{
return 'c';
}
Even the above code will compile and run, since the character 'c' can be implicitly converted into an int by the compiler. The same stands true for your question.
And the overriding which is discussed above is also called "Method overriding using Co-Variant return types"