Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
The provided code demonstrates the use of interfaces in C It defines three interfaces IFirst ISecond ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started