📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      Which of the following is the correct definition of

      'polymorphism' in Object-Oriented Programming?
      A The ability of a class to inherit properties from multiple parent classes Correct Answer Incorrect Answer
      B The ability of different objects to respond to the same method call in different ways Correct Answer Incorrect Answer
      C The process of hiding internal implementation details from the user Correct Answer Incorrect Answer
      D The ability to create multiple instances of the same class Correct Answer Incorrect Answer
      E The process of converting one data type to another Correct Answer Incorrect Answer

      Solution

      Polymorphism (Greek: "many forms") allows objects of different classes to be treated as objects of a common superclass, with each responding differently to the same method. Two types: Compile-time (method overloading) and Runtime (method overriding). Example: a draw() method behaves differently for Circle, Square, and Triangle objects. The other options describe: A = multiple inheritance, C = encapsulation, D = instantiation, E = type casting.

      Practice Next

      Relevant for Exams:

      ask-question