Python - Operator Overloading

Опубликовано: 18 Май 2023
на канале: PythonMaestro
6
2

In this video, we will learn how we can use operators such plus (+), minus (-), equality (==) etc. on our custom class objects.

Operator overloading in object oriented programming is way to change operator behaviour based on operands.

For example: plus (+) operator concatenate two operands if the data type of operand is string, but when operator data type interger/float it perform add operation (i.e. add those numbers)

value1 = 'Arnab'
value2 = 'Ayan'
operation: value1 + value2 will return result 'ArnabAyan'

but if values are numbers
value1 = 10
value2 = 50
operation: value1 + value2 will return result 60

#python #pythontutorial #oops


На этой странице сайта вы можете посмотреть видео онлайн Python - Operator Overloading длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь PythonMaestro 18 Май 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 6 раз и оно понравилось 2 зрителям. Приятного просмотра!