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,
VUE+Canvas Achieve desktop Pinball brick elimination games C/C++ Memory model 2019PHP Interview questions ( Continuously updated )PHPspringboot2 Separation of front and rear platforms ,token Put in header Pit for verification Vue SpringBoot conduct Excel download element-ui Step on pit record 45 The 12-year-old programmer was turned down , Is the workplace wrong ?Python Web frame Pandas Fundamentals of statistical analysis _ data processing (DataFrame Common operations )Java Misunderstanding —— Method overloading is a manifestation of polymorphism ?