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,
Image format conversion Count the number of letters (java Language implementation ) Using orthogonal table method to design test cases One is called “ Asking for the train ” A small village Finally got the train VaR - Value at risk - Monte Carlo method - Python How to build data security system ?python: Convert a file to a binary file (binary)vue use vue-clipboard2 Realize the function of copy link 13. solve git Merge conflict uniapp Summary of page value transfer