Fork me on GitHub
# class Animal:
# def eat(self):
# pass
# def run(self):
# pass
#
# class People(Animal):
# def eat(self):
# print('people is eating')
# def run(self):
# print('people is running')
# class Pig(Animal):
# def eat(self):
# print('pig is eating')
# def run(self):
# print('pig is running')
#
# peo1=People()
# pig1=Pig()
#
# peo1.eat()
# pig1.eat()

# import abc
#
# class Animal(metaclass=abc.ABCMeta):
# @abc.abstractmethod
# def eat(self):
# pass
#
# @abc.abstractmethod
# def run(self):
# pass
#
#
# class People(Animal):
# def eat(self):
# # print('people is eating')
# pass
#
# def run(self):
# # print('people is running')
# pass
#
# class Pig(Animal):
# def eat(self):
# pass
#
# def run(self):
# pass
#
# peo1=People()
# peo1.eat()
#
# pig1=Pig()
# pig1.eat()

# import abc
#
# class File(metaclass=abc.ABCMeta):
# @abc.abstractmethod
# def eat(self):
# pass
#
# @abc.abstractmethod
# def run(self):
# pass
#
# class Disk(File):
# def read(self):
# print('disk read')
# def write(self):
# print('disk write')
#
# class Process(File):
# def read(self):
# print('process read')
# def write(self):
# print('process write')
#
# d=Disk()
# p=Process()
#
# d.read()
# d.write()
#
# p.read()
# p.write()
posted on 2019-12-23 16:56  OBOS  阅读(107)  评论(0编辑  收藏  举报