key word : Non intrusive

First, we need to know what an intrusive interface is , For example, the interface is defined Person Interface :Fight(),Play(),Zhimaoyi(),Zuofan() method
Women Interface :Zhimaoyi(), Zuofan() method Man Interface :Fight(),Play() method
classPerson Class implements the Person All methods of the interface
In the traditional oo In programming language , In order to get one Man Object of , Write at least one classMan Class to implement Man Interface , In order to get one Women You have to write another one classWomen Class to implement Women Interface , In the same way, to get one Person You have to do the same , Obviously, the reuse rate of this code is not high

* Or design the interface like this ,Fight,Play,Zhimaoyi,Zuofan Basic interface ,Man Interface inherited from Fight,Play Interface ,
Women Interface inherited from Zhimaoyi, Zuofan Interface , This is the intrusive interface design ( Although there is no such statement , But it's in tradition oo It's very common in design , It's a lot more complicated than that )
go The concept of non intrusive interfaces does not inherit at all : classPerson
Yes Person Interface , actually classPerson The same is true Women Interface and Man Methods defined by the interface , So in the go in , The following method is legal and recommended var
man Man = new(classPerson) var women Women = new(classPerson)
conventional oo In design , The interface side is strong , It is more flexible in non intrusive interface design , More practical ,  To be continued ...

©2019-2020 Toolsou All rights reserved,
C Review of basic language knowledge Go Language learning notes (GUI programming )Java Misunderstanding —— Method overloading is a manifestation of polymorphism ? How to achieve low cost and high stability for cloud native applications ?elementui Shuttle box el-transfer Display list content text too long C/C++ Memory model Element-Ui assembly Message Message prompt , alert Popup C# Making a simplified version of calculator Python In pycharm editor Interface style modification Tiktok refresh progress bar ( Two little balls turn ), The code is simple