#_ *_ coding:utf-8 _*_# knowledge Point: Interface definition and abstract class and abstract method ' 1, abstract type what? Abstract class plus abstract method is equal to interface 2, the definition of the interface 1, someone to expose you a URL, and then call the URL meaning 2, define a specification, do not write the implementation, according to this specification to implement the relevant functions, abstract class is the "from ABC import Abcmeta , abstractmethod# defines an abstract class class Alert: __metaclass__ = Abcmeta @abstractmethod def Send (self):p the #抽象方法class Foo (A Lert): #继承抽象类 (or inherited interface), you have to follow the specification of the abstract class Def __init__ (self): print ' __init__ ' def Send: #抽象类里有send方法, so, here too must To have the Send method print ' send '. Weixin ' F = Foo () f.send ()
This article is from the "Fa&it-Q Group: 223843163" blog, please be sure to keep this source http://freshair.blog.51cto.com/8272891/1874443
Python's talk about the definition of interfaces and abstract classes and abstract methods