static void Main(string[] args) { IQuittable object1 = new Employee(); //person. Employee employee = new Employee();//instantiation for use employee.firstName = "Deepak"; employee.lastName = "Bandhu"; object1.Quit(employee); Console.WriteLine(employee.firstName + " " + employee.lastName); Console.ReadLine(); }
static void Main(string[] args) { //instantiate an object and give values to its attributes Employee employee = new Employee() { firstName = "Sample", lastName = "Student" }; employee.SayName(); //Use polymorphism to create an object of type IQuittable and call the Quit() method on it IQuittable quittable = new Employee(); quittable.Quit(employee); Console.ReadLine(); }