Python - Operator Overloading

Publicado el: 18 mayo 2023
en el canal de: 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


En esta página del sitio puede ver el video en línea Python - Operator Overloading de Duración hora minuto segunda en buena calidad , que subió el usuario PythonMaestro 18 mayo 2023, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 6 veces y le gustó 2 a los espectadores. Disfruta viendo!