Question: Can anyone plese help me C# Ex1: Create and use an interface In this exercise, youll create an IDisplayable interface and then use it in

Can anyone plese help me C#

Ex1: Create and use an interface

In this exercise, youll create an IDisplayable interface and then use it in the InvItem class of the Inventory Maintenance application from exercise 14-1.

Open the InventoryMaintenance project in the Projects \Chapter 15\InventoryMaint With IDisplayable directory.

Create a public interface named IDisplayable. Then, add the declaration for a method named GetDisplayText with no parameters and a string return value.

Display the code for the InvItem class, and copy the statement in the GetDisplayText method that this class contains. Then, delete this method.

Modify the declaration for the class to indicate that it implements the IDisplayable interface. Then, generate a stub for the GetDisplayText method that this interface defines.

Modify the declaration for the GetDisplayText method so it can be overridden. Then, replace the generated throw statement with the statement you copied from the original GetDisplayText method in step 3.

Test the application to be sure it still works.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!