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,
Final review of database : Summary of comprehensive application questions use Python Make simple games Laplance operator ( Second derivative ) Convert hard disk to GPT Partition format Python Implementation of Hanoi Tower code about String How to create objects vue3 Learning journey 1—— establish vue3 project java String from back to front _Java String String summary use Python Write a story about plants versus zombies 【 Greedy Algorithm 】 Huffman coding problem