Intrusive interface : You need to explicitly create a class to implement an interface .

Non intrusive interface : There is no need to explicitly create a class to implement an interface .

C++ Intrusive interface :

#include <iostream> enum SEX { MAIL, FEMAIL }; class PeopleInterface { public:
PeopleInterface(){}; virtual ~PeopleInterface(){}; virtual int getSex() = 0; };
class Man : public PeopleInterface { public: Man(){}; ~Man(){}; int getSex()
{return MAIL;} }; int main(int argc, char const *argv[]) { Man m;
std::cout<<"sex:"<<m.getSex()<<std::endl; return 0; }
go Non intrusive interface

package main import "fmt" type People interface { getSex() } type Man struct {
} func (m Man) getSex() int { return 0 } func main() { var m Man fmt.Println(
"sex:", m.getSex()) }

Want to implement an interface , Directly implement the methods contained in the interface , Don't worry too much about which method belongs to which interface .

©2019-2020 Toolsou All rights reserved,
One is called “ Asking for the train ” A small village Finally got the train SparkSQL Achieve partition overlay write Character recognition technology of vehicle license plate based on Neural Network c++ Memory Pointer out of bounds detection mechanism _CrtMemBlockHeade Change one's mind ! Tesla starts to deliver made in China to European market Model 3Qt study 7—— Modal and modeless dialog boxes JavaScript Medium Call and ApplyJAVA Convert a string to a numeric type k8s Entry to give up --k8s Key concepts Count the number of letters (java Language implementation )