1.

What Is Shadowing?

Answer»

Shadowing is either through scope or through inheritance. Shadowing through inheritance is hiding a METHOD of a base class and PROVIDING a new IMPLEMENTATION for the same. This is the default when a derived class writes an implementation of a method of base class which is not declared as overridden in the base class. This also serves the PURPOSE of protecting an implementation of a new method against subsequent addition of a method with the same name in the base class.’shadows’ keyword is RECOMMENDED although not necessary since it is the default.

Shadowing is either through scope or through inheritance. Shadowing through inheritance is hiding a method of a base class and providing a new implementation for the same. This is the default when a derived class writes an implementation of a method of base class which is not declared as overridden in the base class. This also serves the purpose of protecting an implementation of a new method against subsequent addition of a method with the same name in the base class.’shadows’ keyword is recommended although not necessary since it is the default.



Discussion

No Comment Found