1
Reply

.NET and Java J2ee design pattern interview question :-What is the difference between Object and class adapters?

    Answer:

    Below are the main difference between these 2 patterns.

    Object adapter
     
    Can adapt classes as well as sub classes since uses composition
    More flexible since dynamic polymorphism can be used with composition

    Class adapter

    Can adapt classes or sub classes not both. As a result no need to re implement the entire adaptee
    More efficient since class adapter acts as adapter and adaptee

    regards,
    Please do visit my .NET Design patterns and Java J2EE design pattern interview questions