Answered step by step
Verified Expert Solution
Link Copied!

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

image

{ 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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Primer Plus

Authors: Stephen Prata

6th Edition

978-0321776402, 0321776402

More Books

Students also viewed these Programming questions

Question

Name the five levels of the Capability Maturity Model.

Answered: 1 week ago