Method Overloading — what type of polymorphism?

Get ready for your Object‑Oriented Programming Test. Use flashcards and multiple-choice questions. Each question includes hints and explanations. Prepare for your exam today!

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