What is composition in OOP in Python?
Correct answer
B. Building classes by including other objects as attributes
10 views
B. Building classes by including other objects as attributes
10 views
Composition models a has-a relationship and is often preferred over inheritance.
Asked in: Python Interview OOP
https://docs.python.org/3/tutorial/classes.htmlNot sure why the answer is B? Ask here and get an explanation.