I'm trying to wrap my brain around something here... Let's say that I have a simple setup of class inheritance:
class SuperClass(object):
def __init__(self):
self.var = 1
class SubClass(SuperClass):
def getVar(self):
return self.var
If I have an existing instance of SuperClass
, is there a way that I can 'cast' it as SubClass
, without creating a new instance?