Interface designing and Implementation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akhilc2005
    New Member
    • Aug 2021
    • 2

    Interface designing and Implementation

    Hi Friends,

    Below is the question I encountered and still figuring out how to implement it. Can someone help.

    Implement the IIMage interface. This interface defines an image, defined as a rectangle of some width and height
    where each pixel has a color which can be set and retrieved.

    · Implement Image interface to draw an image with specific height and width.
    · Each pixel can be set different color.
    · User “C# Indexer” to complete the above problem.


    public interface IIMage
    {
    IColor this[int x, int y] [get;set;}
    }

    public interface IColor
    {

    }


    public class MyIMage : IIMage
    {

    public MyImage (int width, int height, IColor efaultColor)
    {
    }

    public IColor this[int x, int y]
    { get => throw new NotImplementedE xception();
    set => throw new NotImplementedE xception();
    }
    }
Working...