What is the difference between method overloading and overriding?easy
Answer
Overloading defines multiple methods with the same name but different parameter signatures in the same class. Overriding redefines a parent class method in a subclass with the same signature.
Explanation
Overloading is compile-time polymorphism - the correct method is chosen by the compiler based on argument types. Overriding is runtime polymorphism - the JVM or runtime selects the method based on the actual object type. Python does not support traditional overloading; default parameters or *args are used instead.
Follow-upWhat happens if you call a method on a parent reference that points to a child object?