Default Adapter

xiaoxiao2021-03-05  25

I. Overview

When you do not need to implement the method provided by the adapter interface, you can design an abstract class to implement the adapter interface and provide a default implementation (null method) for the interface. The subclass of the abstract class can have a method of selectively covering the parent class to achieve a demand.

Second, the structure

Third, motive

When an interface does not want to use all its methods

转载请注明原文地址:https://www.9cbs.com/read-36213.html

New Post(0)