Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following term describes the ability of a class to provide common interface for different types of objects in object-oriented programming ?

  • A.Encapsulation
  • B.Polymorphism
  • C.Inheritance
  • D.Abstraction

Answer: B

The term is polymorphism.

Polymorphism lets objects of different classes be used through one common interface: a call such as shape.draw() runs the right version for a circle or a square. It is achieved through inheritance with overridden methods, interfaces and overloading.

Encapsulation hides an object's data behind its methods. Inheritance lets a class acquire the members of another; it supports polymorphism but is not the ability itself. Abstraction exposes essential features while hiding detail.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.