Method Overloading — what type of polymorphism?

Prepare for the Object-Oriented Programming Test with flashcards and multiple choice questions. Each question comes with hints and explanations to enhance understanding. Master OOP concepts and succeed in your exam!

Multiple Choice

Method Overloading — what type of polymorphism?

Explanation:
Method overloading defines multiple methods with the same name but different parameter lists, and the compiler uses the call site to pick the correct overload based on the argument types and counts. This binding happens during compilation, so the call is resolved before the program runs. That makes it compile-time polymorphism (static polymorphism). In contrast, runtime polymorphism comes from overriding methods with dynamic dispatch, where the actual method invoked is determined at run time. Ad-hoc polymorphism is a broader category that includes overloading, but the specific behavior of overloading and its resolution timing is best described as compile-time polymorphism.

Method overloading defines multiple methods with the same name but different parameter lists, and the compiler uses the call site to pick the correct overload based on the argument types and counts. This binding happens during compilation, so the call is resolved before the program runs. That makes it compile-time polymorphism (static polymorphism). In contrast, runtime polymorphism comes from overriding methods with dynamic dispatch, where the actual method invoked is determined at run time. Ad-hoc polymorphism is a broader category that includes overloading, but the specific behavior of overloading and its resolution timing is best described as compile-time polymorphism.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy