1. 程式人生 > >Python 定義抽象類

Python 定義抽象類

spa color strac bject bsp class object cnblogs print

from abc import ABCMeta, abstractmethod


class DataSet(object):
    __metaclass__ = ABCMeta

    def __init__(self):
        print("Abstract DataSet")

    @abstractmethod
    def read(self, conf): pass

    @abstractmethod
    def write(self, conf): pass

Python 定義抽象類