How many arguments can you pass to an overloaded binary operator .. and why ?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

How many arguments can you pass to an overloaded binary operator .. and why ??

8th Nov 2016, 4:06 PM
Shahem Wahba
Shahem Wahba - avatar
2 Respostas
+ 4
2 arguments, for example: if you overload the operator = to equal arrays, you could still use it with normal variables. first argument -> normal variables -> int x = y; second argument -> arrays -> int array[5] = array2[5];
8th Nov 2016, 5:44 PM
Hector Sulbaran
Hector Sulbaran - avatar
+ 2
for any binary operator like +,-,*,/,%,= etc you need two operators to work on. So,we need to pass two operands as arguments either implicitly or explicitly.
8th Nov 2016, 6:31 PM
kamal joshi
kamal joshi - avatar