Difference between object adapter pattern and class adapter pattern

前端 未结 5 1499
滥情空心
滥情空心 2020-12-13 09:50

How to decide when to use object adapter and when to use class adapter?

Problem statement: To create social networking web site and provide import functionality from

5条回答
  •  生来不讨喜
    2020-12-13 10:35

    A class adapter uses multiple inheritance to adapt one interface to another: (depending on your programming language: Java & C# does not support multiple inheritance)

    enter image description here

    An object adapter depends on object composition:

    enter image description here

    Images Source: Design Pattern (Elements of Reusable Object-Oriented Software) book

提交回复
热议问题