classmethod and staticmethod in a subclass
Predict the outputMediumPython only
class Base:
@classmethod
def make(cls):
return cls.__name__
@staticmethod
def info():
return "static"
class Child(Base):
pass
print(Base.make(), Child.make())
print(Child().make())
print(Child.info(), Child().info())
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.