Name: Anonymous 2011-11-16 23:32
I am defining a class, and one of the methods I want is to return the SUM of two objects which hold int values. My code currently reads -
def get_total(self):
return self.__num1 + self.__num2
The error I get -
return self.__num1 + self.__num2
TypeError: unsupported operand type(s) for +: 'Num' and 'Num'
If anyone can help me out I'd appreciate it.
def get_total(self):
return self.__num1 + self.__num2
The error I get -
return self.__num1 + self.__num2
TypeError: unsupported operand type(s) for +: 'Num' and 'Num'
If anyone can help me out I'd appreciate it.