1 Write a program to create an ‘Employee’ class (Base) with the public Show() method. Create ‘SalaryEmployee’ class (Derived) with Display() method which should internally call the Show() method of Employee class. Show the methods’ content using class objects in the Console application.
class Program
{
public class Employee
{
public void show()
{
Console.WriteLine("Display the show method");
}
}
public class SalaryEmployee : Employee
{
public void
Display()
{
Console.WriteLine();
Console.WriteLine("This Display method and internally call to show
method");
Console.WriteLine();
show();
}
}
static void Main(string[] args)
{
SalaryEmployee SE = new SalaryEmployee();
SE.show();
SE.Display();
Console.ReadLine();
}
}
OUTPUT:
No comments:
Post a Comment