+ 2
Why do we override?
3 Respuestas
+ 1
If one class is inherited by another one , we can define the methods of super cls as we wish in the sub cls. This is called override. A main concept of OOP ,Polymorphism.
+ 1
because we need to implement diiferent behaviour in the same name of method. it is usually implemented in the class that implements some class to have specific classes
+ 1
usually you overload where a method exist with a defined behavior in a super class which does not fulfill your requirements in the subclass that you are working with. often times you cannot change the super class method since it does another job elsewhere and you cannot rewrite your own method full blown (WET). So you take this super class method, and overload it so that it does what you want employing it properties in your own way.