Question

What is the main purpose of an interface in OOP?

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

Hey! Ask a query