Python - Operator Overloading

Publicado em: 18 Maio 2023
no 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


Nesta página do site você pode assistir ao vídeo on-line Python - Operator Overloading duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário PythonMaestro 18 Maio 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 6 vezes e gostou 2 espectadores. Boa visualização!