Shadowing

Redefining methods of the parent class in a child class.

Methods of the parent class can be redefined in the child class. This redefinition of the function using the same name is called shadowing. Consider the following code:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.