Question: explain and give the output { using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace InterfaceDemo { } { } public interface IFirst { void
explain and give the output

{ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace InterfaceDemo { } { } public interface IFirst { void FirstMethod(); } public interface ISecond { void SecondMethod(); } public class First: IFirst //implement interface public void FirstMethod() { Console.WriteLine("First"); } public class Second: ISecond //implement interface public void SecondMethod() { Console.WriteLine("Second"); } public class FirstAndSecond: IFirst, ISecond //implement interface { } First first = new First(); Second second = new Second(); public void FirstMethod() { first.FirstMethod(); } public void SecondMethod() { second.SecondMethod(); } class Program { static void Main(string[] args) { FirstAndSecond fAndS = new FirstAndSecond(); fAndS.FirstMethod(); fAndS.SecondMethod(); Console.ReadKey(); } }
Step by Step Solution
3.50 Rating (160 Votes )
There are 3 Steps involved in it
The provided code demonstrates the use of interfaces in C It defines three interfaces IFirst ISecond ... View full answer
Get step-by-step solutions from verified subject matter experts
