Sunday, March 4, 2018

Tutorial 12 What is method Hiding next Level to Inheritance?

What is the concept of Method Hiding?

When we are inheriting from base class and there are 2 methods with same name in base and derived class then which method will be called.

This situation is called method hiding and for you guys method of derived class will be called. Lets see with example to understand better.


The Result is :

To use base method just we need to write while initiating the constructor as :
baseclass variablename = new dericedclass();




No comments:

Post a Comment