如何在Python中实现纯虚方法?

时间:2015-01-21 14:44:18

标签: python pure-virtual virtual-method

我还没有找到。同时我现在正在使用这样:

@abc.abstractmethod
def pure_virtual_method(self, a, b):
    """
      Method description.
      :param a: Whatever...
      :param b: Whatever...
      :returns: Whatever...
    """
    #   This line should never be executed.
    raise NotImplementedError(
        'pure virtual method specification called instead of any '
        'implementation')

0 个答案:

没有答案