Python - Operator Overloading

Published: 18 May 2023
on channel: 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


On this page of the site you can watch the video online Python - Operator Overloading with a duration of hours minute second in good quality, which was uploaded by the user PythonMaestro 18 May 2023, share the link with friends and acquaintances, this video has already been watched 6 times on youtube and it was liked by 2 viewers. Enjoy your viewing!