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 {

{ 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

1 Expert Approved Answer
Step: 1 Unlock

The provided code demonstrates the use of interfaces in C It defines three interfaces IFirst ISecond ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!