How to hide the base class functionality in Inheritance?
Abhishek Tyagi
We can use new operator to hide the base class functionality.
We can use new operator to hide the base class functionality......
using virtual method in base class and override in child class.And also using new class without declaring virtual and override
If you are using sealed method then it is not going to be overridden in derived class, but you want to hide then you have to use 'new' in base class.You can use 'New' keyword with data as well as with method of the class to hide it in inheritance.
Hi! if u want to hide base class functionality,use "New" keyword instead of Sealed.Because,Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as sealed class, this class cannot be inherited.One of the best usage of sealed classes is when you have a class with static members. For example, the Pens and Brushes classes of the System.Drawing namespace.
using new keyword
if we declare those functionality which we dont want to inherited in child class then we have to use sealed keyword.
you can hide the base class functionality by using the new keyword