You are tasked with designing a class structure where some classes share some common behavior but also have their unique behaviors. How would you design such a class structure?

  • Use Composition
  • Use Encapsulation
  • Use Inheritance
  • Use Polymorphism
To design a class structure where some classes share common behavior but also have unique behavior, you would use Composition. Composition involves creating objects of one class within another class, allowing you to combine the behavior of multiple classes while maintaining flexibility for unique behaviors.
Add your answer
Loading...

Leave a comment

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