To override method , is it compulsory to use override keyword? why we can't override method just like in c++ using same name with different definition. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

To override method , is it compulsory to use override keyword? why we can't override method just like in c++ using same name with different definition.

I wanted to know that in c++ , all is needed to have a same name method with different definition but in c# both method should be declare with override keyword??

9th Sep 2018, 5:29 PM
shiwangee pathak
shiwangee pathak - avatar
2 Respostas
+ 1
Same name different parameters is overloading. The override is only required when you inherit a method from your ancestor class with the same name and parameters that you wish to change. You can overload that method with different parameters without the override.
9th Sep 2018, 10:18 PM
John Wells
John Wells - avatar
+ 1
thank u sir for helping me.
10th Sep 2018, 5:42 AM
shiwangee pathak
shiwangee pathak - avatar