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


    Question

    What is the main purpose of an interface in

    OOP?
    A To provide a complete implementation of a class. Correct Answer Incorrect Answer
    B To define a contract for classes, specifying methods that implementing classes must provide. Correct Answer Incorrect Answer
    C To allow multiple inheritance in languages that don't support it directly. Correct Answer Incorrect Answer
    D To hide all data members from external access. Correct Answer Incorrect Answer
    E To create objects without using a constructor. Correct Answer Incorrect Answer

    Solution

    To define a contract for classes, specifying methods that implementing classes must provide.

    Practice Next
    ask-question