does objects have its methods or invoke them from superclass in python? for example:
class tst():
def __init__(self,name,family):
self.name=name
self.family=family
def fun(self,a,b):
print(a+b)
newtst=tst("myname","my family")
tst.fun(newtst,3,5)
newtst.fun(3,5)
in the code above does newtst object invoke fun function from tst class or it has own method and run it directly
and if the latter is true why we need to self parameter in definition class's functions
and in know that id(newtst.fun) is different from id(tst.fun) but i think that differences is because of creating new method's object in memory.
newtstis an instance oftst. And you don't have to pass the instance object tofunmethod as it's first argument.