Question: What is composition in OOP?Answer: Composition is a way of creating complex objects by combining simpler objects or classes. It involves creating relationships between objects rather than relying on inheritance.Example:
|
Is it helpful?
Yes
No
Most helpful rated by users:
- What is Object-Oriented Programming (OOP)?
- Explain the four pillars of OOP.
- How does inheritance work in PHP?