Is overlapping polymorphism mandatory?

Asked

Viewed 157 times

5

In overlapping polymorphism is it mandatory that the method of a mother class that will be superimposed on a subclass be abstract? Is there an exception for some POO language?

1 answer

4


It is not obliged and it is quite common that it is not. The only requirement is that it has the same signing.

Some languages may have a signature that only considers the method name, which is very easy.

Each language can do as it wants, but I don’t know any that requires this.

What exists is that in a given construction in some languages, such as the interface, it requires the method to be abstract, but not in a mother class. C++ has no interfaces.

Of course every abstract method needs to be superimposed. It might not require it, but then it would have no purpose to have all this mechanism.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.