[Tutor] overloaded methods

Karthik Gurumurthy karthikg@aztec.soft.net
Mon, 31 Dec 2001 19:20:50 +0530


just to confirm. Overloading method names(with parameters belonging to
different types)
is not possible in python.

class Currency:
	pass
class Dollar(Currency):
	pass
class Euro(Currency):
	pass

class CalculateRupeeEquivalent:
	def calculate(currency):
		//type checking of curency here?
		//i don't like it with lots of ifs and else.

so alternative is...

class CalculateRupeeEquivalentForDollar(CalculateRupeeEquivalent):
	def calculate(currency):
		//return equivalent


class CalculateRupeeEquivalentForEuro(CalculateRupeeEquivalent):
	def calculate(currency):
		//return equivalent


if __name__ == '__main__':
	calc = a.GetCalculator()
	curr = a.GetCurrency()
	calc.calculate(curr)



karthik.