zoukankan      html  css  js  c++  java
  • ARTS-S python抽象方法抽象类

    # coding: utf-8
    
    from abc import ABC, abstractmethod
    
    
    class AbstractClassExample(ABC):
    
        def __init__(self, value):
            self.value = value
            super().__init__()
    
        @abstractmethod
        def do_something(self):
            pass
    
    
    class A(AbstractClassExample):
        def do_something(self):
            print("hello AAA:{}".format(self.value))
    
    
    class B(AbstractClassExample):
        def do_something(self):
            print("hello BBB:{}".format(self.value))
    
    
    if __name__ == '__main__':
        a = A(1)
        a.do_something()
        b = B(2)
        b.do_something()
    
    
  • 相关阅读:
    bzoj 4007
    bzoj 2190
    bzoj 2186
    bzoj 2005
    bzoj 2721
    bzoj 1951
    CF919F
    CF1005F
    CF1019C
    bitset用法详解
  • 原文地址:https://www.cnblogs.com/zhouyang209117/p/10985828.html
Copyright © 2011-2022 走看看