from abc import ABC, abstractmethod
class AbstractClass(ABC):
@abstractmethod
def method(self):
...
class Subclass(AbstractClass):
def method(self):
return "Metodo da subclasse"
class VirtualSubclass:
def method(self):
return "Metodo da subclasse virtual"
AbstractClass.register(VirtualSubclass)
print(issubclass(Subclass, AbstractClass))
print(issubclass(VirtualSubclass, AbstractClass))
ZnJvbSBhYmMgaW1wb3J0IEFCQywgYWJzdHJhY3RtZXRob2QKCmNsYXNzIEFic3RyYWN0Q2xhc3MoQUJDKToKICAgIEBhYnN0cmFjdG1ldGhvZAogICAgZGVmIG1ldGhvZChzZWxmKToKICAgICAgICAuLi4KCgpjbGFzcyBTdWJjbGFzcyhBYnN0cmFjdENsYXNzKToKCWRlZiBtZXRob2Qoc2VsZik6CgkJcmV0dXJuICJNZXRvZG8gZGEgc3ViY2xhc3NlIgoKCmNsYXNzIFZpcnR1YWxTdWJjbGFzczoKCWRlZiBtZXRob2Qoc2VsZik6CgkJcmV0dXJuICJNZXRvZG8gZGEgc3ViY2xhc3NlIHZpcnR1YWwiCgpBYnN0cmFjdENsYXNzLnJlZ2lzdGVyKFZpcnR1YWxTdWJjbGFzcykKCgpwcmludChpc3N1YmNsYXNzKFN1YmNsYXNzLCBBYnN0cmFjdENsYXNzKSkKcHJpbnQoaXNzdWJjbGFzcyhWaXJ0dWFsU3ViY2xhc3MsIEFic3RyYWN0Q2xhc3MpKQ==