Overlay polymorphism is required?

5

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

    
asked by anonymous 04.01.2018 / 17:48

1 answer

4

It is not obligatory and it is quite common that it is not. The only requirement is that it has the same signature .

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

Each language can do as you wish, but I do not know anything that requires this.

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

Of course, every abstract method needs to be superimposed. It might not require it, but there would be no point in having all this mechanism.

    
04.01.2018 / 17:54