|
class MySuperClass(type): # Generic inheritance
pass
class MySubclass(MyClass): # Objects of MySubclass
pass # inherit MyClass
class MyClass(metaclass=MySuperClass): # Class of a class
pass
super.variable_name
super().__init__([args...])
class Derived(Base):
def meth(self):
super(Derived, self).meth()
class DerivedClassName(Base1, Base2, Base3):
(though this may not always work in practice: what does it mean to be both a menu and a button, for example?).
issubclass(class, classinfo)
def is_further_from_equator_than(self,other):
if (self.x > other.x): return True
else: return False
print(dog.is_further_from_equator_than(cat))
Where dog and cat inherit and instantiate Agent.
object.__str__()
def __str__(self) :
return "Hi I'm an agent"