Я не могу решить проблему. Программа должна скрыть «Printfullname()» из класса employee.Элемент «methodhiding.parttimeemployee.printfullname()» не скрывает унаследованного пользователя
using System;
namespace MethodHiding
{
public class Employee
{
public string first;
public string last;
public void PrintFullName()
{
Console.WriteLine(first + " " + last);
}
}
public class PartTimeEmployee : Employee
{
public new void PrintFullname()
{
Console.WriteLine(first + " " + last + "- Contractor ");
}
}
public class FullTimeEmployee : Employee
{
}
class MainClass
{
public static void Main (string[] args)
{
PartTimeEmployee PTE = new PartTimeEmployee();
PTE.first = "abc";
PTE.last = "Sarfraz";
PTE.PrintFullName();
FullTimeEmployee FTE = new FullTimeEmployee();
FTE.first= "hjk";
FTE.last = "poi";
FTE.PrintFullName();
}
}
}
PrintFull ** n ** ame! = PrintFull ** N ** ame –