Part -14 Method hiding in C#
Method hiding in C#
1.Method hiding
2.Invoke hidden methods.
Method hiding:
it is a hiding methods of base class from derived class, you can hide the implementation of the methods of the base class from derived class by using new keyword.
internal class Program
{
public static void Main()
{
Employee EMP = new FullTimeEmployee();
EMP.Displaymessage();
}
}
public class Employee
{
public int EmpID { get; set; }
public string EmpName { get; set; }
public void Displaymessage()
{
Console.WriteLine("this is employee method");
}
}
public class FullTimeEmployee:Employee
{
public new void Displaymessage()
{
Console.WriteLine("this is FullTimeemployee method");
}
}
public class PartTimeEmployee : Employee
{
public new void Displaymessage()
{
base.Displaymessage();
}
}
Видео Part -14 Method hiding in C# канала Code Insights by Surya
1.Method hiding
2.Invoke hidden methods.
Method hiding:
it is a hiding methods of base class from derived class, you can hide the implementation of the methods of the base class from derived class by using new keyword.
internal class Program
{
public static void Main()
{
Employee EMP = new FullTimeEmployee();
EMP.Displaymessage();
}
}
public class Employee
{
public int EmpID { get; set; }
public string EmpName { get; set; }
public void Displaymessage()
{
Console.WriteLine("this is employee method");
}
}
public class FullTimeEmployee:Employee
{
public new void Displaymessage()
{
Console.WriteLine("this is FullTimeemployee method");
}
}
public class PartTimeEmployee : Employee
{
public new void Displaymessage()
{
base.Displaymessage();
}
}
Видео Part -14 Method hiding in C# канала Code Insights by Surya
Комментарии отсутствуют
Информация о видео
11 февраля 2022 г. 15:58:12
00:10:43
Другие видео канала