Witllm/test/abc.py

29 lines
435 B
Python
Raw Normal View History

2024-01-21 12:45:56 +08:00
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()