Question
In OOP, what term best describes the relationship where
one object is a part of another but cannot exist independently?Solution
Composition is a "has-a" relationship where one object contains another, and the contained object cannot exist independently of the parent. 1. Dependency: For instance, an engine is part of a car and cannot function independently outside of it. 2. Tight Coupling: The lifecycle of the child object depends entirely on the parent object. If the parent is destroyed, the child is destroyed too. 3. Reusability: Composition fosters code reuse by enabling modular design without strict inheritance hierarchies. Option A exemplifies composition through its strong containment relationship, central to creating complex, interdependent systems. Why Other Options Are Incorrect: тАв B) Aggregation: Denotes a weaker "has-a" relationship, where components can exist independently. тАв C) Inheritance: Refers to property sharing, not containment. тАв D) Polymorphism: Focuses on method behavior variability. тАв E) Association: A general relationship without specific containment rules.
PRIME RATE рдХреЗ рд▓рд┐рдП рдЕрдВрдЧреНрд░реЗрдЬреА рд╢рдмреНрдж┬а рд╣реИ тАУ
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдлрд╕рд▓ рд╕рдореБрдЪреНрдЪрдп┬а рдХрд╛ рд╡рд┐рддреНрддреАрдп рд╢рдмреНрджрд╛рд╡рд▓реА рдХреЗ рдЕрдиреБ...
рдЬрдорд╛рдирдд рдкреНрд░рддрд┐рднреВрддрд┐ рдЬрдорд╛ рдХреЗ рд▓рд┐рдП рд▓рд┐рдП рд╕рд╣реА рдкрд╛рд░рд┐рднрд╛рд╖рд┐рдХ рд╢рдмреНрдж рд╣реИ
...рд▓реЗрдЦрд╛рдХрд╛рд░ рд╢рдмреНрдж рдХрд╛ рдЕрдВрдЧреНрд░реЗрдЬреА рдореЗрдВ рд╕рд╣реА рдЕрд░реНрде рд╣реИред
POLITICAL рдХреЗ рд▓рд┐рдП рд╕рд╣реА рд╣рд┐рдиреНрджреА рдкрд╛рд░рд┐рднрд╛рд╖рд┐рдХ рд╢рдмреНрдж рд╣реИ
рдЖрд╢рд╛рдмреНрджрд┐рдХ рд╕рдореНрдкреНрд░реЗрд╖рдг рдХрд╛ рд╡рд┐рд╢реЗрд╖ рд╢рд┐рдХреНрд╖рд╛ рдХреЗ рдХреНрд╖реЗрддреНрд░ рдореЗрдВ рдкреНя┐╜...
рд╡рдХреАрд▓реЛрдВ рдХреЛ рдиреНрдпрд╛рдпрдкрд╛рд▓рд┐рдХрд╛ рдХрд╛ рдореБрдЦрдкрддреНрд░ рд╣реЛрдирд╛ рдЪрд╛рд╣рд┐рдПред
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ Adulterant рд╢рдмреНрдж рдХрд╛ рд╡рд┐рддреНрддреАрдп рд╢рдмреНрджрд╛рд╡рд▓реА рдореЗрдВ рд╕рд╣...
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдЕрдВрдЧреНрд░реЗрдЬреА рд╡рд╛рдХреНрдп рдХрд╛ рд╣рд┐рдВрджреА рдореЗрдВ┬а рд╕рд╣реА рдЕрдиреБрд╡рд╛рдж рдЪреБрдирд┐рдП...
(A ) рд╡рд┐рд╢реНрд╡ рдореЗрдВ рдХрдИ рджреЗрд╢ рдЕрдкрдиреА рд╕реНрд╡рд╛рд░реНрде рдкреВрд░реНрддрд┐┬а рдХреЗ рд▓рд┐рдП рдХреЛрдИ рднреА рдХрджрдо рдЙя┐╜...