Witllm/test/abc.py

29 lines
435 B
Python

from abc import ABC, abstractmethod
class People(ABC):
# @abstractmethod
def walk(self):
pass
@abstractmethod
def eat(self):
pass
def auto(self):
self.walk()
self.eat()
class kid1(People):
def __init__(self):
pass
def walk(self):
print('走路')
def eat(self):
print('吃饭')
if __name__ == '__main__':
k = kid1()
k.auto()