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


    Question

    What is the primary benefit of

    polymorphism?
    A To reduce memory consumption. Correct Answer Incorrect Answer
    B To allow for more rigid and less flexible code. Correct Answer Incorrect Answer
    C To write more generic and reusable code that can work with objects of different types. Correct Answer Incorrect Answer
    D To prevent data from being modified. Correct Answer Incorrect Answer
    E To enforce a strict hierarchy of classes. Correct Answer Incorrect Answer

    Solution

    Polymorphism enables writing code that operates on base class references or interface types, but can actually work with objects of any of their derived classes or implementing classes. This leads to more flexible, extensible, and reusable code, as new types can be added without modifying existing code that uses the polymorphic interface.

    Practice Next
    ask-question