Qus:    What is Method Hiding in C#?
Nov 30, 2020 13:38 2 Answers Views: 98 SAI

If the child class don’t want to use methods from the base class, child class can implement its own version of the same method with same signature. For example, in the classes below, Pipedrive () is implemented in the child class with same signature. This can be called as Method Hiding.

class Car

{

public void TypeOfDrive()

{

Console.WriteLine("Right Hand Drive");

}

}

class Ford : Car

{

public void TypeOfDrive()

{

Console.WriteLine("Right Hand ");

}

}

Prev Next
Answers (2)
PARTH Dec 01, 2020 08:10
Answer:   Method Hiding means to hide the methods of the base class from derived class. It is also known as Method Shadowing. In method hiding, you can hide the implementation of the methods of a base class from the derived class using the new keyword.

DIVYA Dec 01, 2020 09:11
Answer:   If the child class don’t want to use methods from the base class, child class can implement its own version of the same method with same signature. For example, in the classes below, Pipedrive () is implemented in the child class with same signature. This can be called as Method Hiding.
class Car
{
public void TypeOfDrive()
{
Console.WriteLine("Right Hand Drive");
}
}
class Ford : Car
{
public void TypeOfDrive()
{
Console.WriteLine("Right Hand ");
}
}

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect