OOP & Design Patterns - Adapter vs Facade vs Proxy - Structural Pattern ComparisonWhich of the following is a misunderstanding about the Adapter pattern?AAdapter changes the interface of an existing class to make it compatible with another.BAdapter adds new functionality to the existing class without changing its interface.CAdapter allows classes with incompatible interfaces to work together.DAdapter acts as a wrapper to translate one interface to another.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand Adapter's purposeAdapter converts one interface to another without changing the original class.Step 2: Identify misconceptionAdapter does not add new functionality; it only adapts interfaces.Final Answer:Adapter adds new functionality to the existing class without changing its interface. -> Option BQuick Check:Adapter adapts interfaces, does not add features [OK]Quick Trick: Adapter adapts interfaces, not functionality [OK]Common Mistakes:MISTAKESConfusing Adapter with Decorator patternAssuming Adapter modifies original class behaviorThinking Adapter adds featuresTrap Explanation:PITFALLOption B confuses Adapter with Decorator, which adds functionality.Interviewer Note:CONTEXTTests understanding of Adapter's role in interface compatibility.
Master "Adapter vs Facade vs Proxy - Structural Pattern Comparison" in OOP & Design Patterns2 interactive learning modes - each teaches the same concept differentlySolutionTrace
More OOP & Design Patterns Quizzes Decorator Pattern - Wrapping Behaviour Without Subclassing - Decorator Pattern - Wrapping Behaviour Without Subclassing - Quiz 7medium Design Snake and Ladder Game - LLD End-to-End - Design Snake and Ladder Game - LLD End-to-End - Quiz 12easy Design a Parking Lot - LLD with OOP (Classes, Patterns, Extensibility) - Design a Parking Lot - LLD with OOP (Classes, Patterns, Extensibility) - Quiz 7medium Design a Parking Lot - LLD with OOP (Classes, Patterns, Extensibility) - Design a Parking Lot - LLD with OOP (Classes, Patterns, Extensibility) - Quiz 5medium Design a Parking Lot - LLD with OOP (Classes, Patterns, Extensibility) - Design a Parking Lot - LLD with OOP (Classes, Patterns, Extensibility) - Quiz 4medium Encapsulation - Data Hiding, Getters/Setters & Access Modifiers - Encapsulation - Data Hiding, Getters/Setters & Access Modifiers - Quiz 7medium Encapsulation - Data Hiding, Getters/Setters & Access Modifiers - Encapsulation - Data Hiding, Getters/Setters & Access Modifiers - Quiz 3easy Single Responsibility Principle - One Class, One Reason to Change - Single Responsibility Principle - One Class, One Reason to Change - Quiz 7medium Single Responsibility Principle - One Class, One Reason to Change - Single Responsibility Principle - One Class, One Reason to Change - Quiz 13medium Template Method Pattern - Define Skeleton, Override Steps - Template Method Pattern - Define Skeleton, Override Steps - Quiz 2easy