Why we use @override in function overridin? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Why we use @override in function overridin?

6th Aug 2018, 5:53 AM
Shinwari
Shinwari - avatar
2 Respuestas
+ 1
This annotation only checks for a override condition (base class have function with same signature) and prevent your compilation when it needed You can write your overriden function without this annotation, but if you make a mistake (for example, in function return type), you will be never notificated
6th Aug 2018, 8:45 AM
Mishin870
Mishin870 - avatar
+ 1
It's an annotation. It's like a public announcement, "Hey guys. I'm overriding this method to give it new functionality. Don't shoot me please, I'm changing the original implementation."
6th Aug 2018, 6:01 AM
Don
Don - avatar