You are developing a system where you have multiple classes, and you want to ensure that a particular set of methods is available in all these classes. How would you ensure this?

  • Use Composition
  • Use Encapsulation
  • Use Inheritance
  • Use Polymorphism
To ensure that a particular set of methods is available in multiple classes, you would use Inheritance. Inheritance allows a class to inherit properties and methods from another class, making it possible to create a base class with common methods that are shared by multiple derived classes.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *