、私の質問はobj1.hello3("1param","2param") obj1.hello3("11param")
あるこれらの文は、この継承やポリモーフィズムプロパティ
#!/usr/bin/python
class test1:
c,d = ""
def __init__(self,n):
self.name = n
print self.name+"==In a"
def hello1(self):
print "Hello1"
def hello3(self,a,b):
#print "Hello3 2 param"+str(a)+str(b)
#print "ab"+str(self.a)+str(self.b)+"Hello1"
print "Hello3 2 param"
def hello3(self,a):
#print "a"+str(self.a)+"Hello1"
print "Hello3 1 param"+str(a)
class test2(test1):
def __init__(self,b):
test1.__init__(self, "new")
self.newname = b
print self.newname+"==In b"
def hello2(self):
print "Hello2"
obj= test1("aaaa")
obj1=test2("bbbb")
obj1.hello1()
obj1.hello2()
obj1.hello3("1param","2param")
obj1.hello3("11param")
メソッドのオーバーロードはPythonではサポートされていませんか? – Rajeev