fork download
  1. from abc import ABC, abstractmethod
  2.  
  3. class AbstractClass(ABC):
  4. @abstractmethod
  5. def method(self):
  6. ...
  7.  
  8.  
  9. class Subclass(AbstractClass):
  10. def method(self):
  11. return "Metodo da subclasse"
  12.  
  13.  
  14. class VirtualSubclass:
  15. def method(self):
  16. return "Metodo da subclasse virtual"
  17.  
  18. AbstractClass.register(VirtualSubclass)
  19.  
  20.  
  21. print(issubclass(Subclass, AbstractClass))
  22. print(issubclass(VirtualSubclass, AbstractClass))
Success #stdin #stdout 0.02s 9196KB
stdin
Standard input is empty
stdout
True
True