Loading, please wait...

A to Z Full Forms and Acronyms

Interface concept using C# Language

Jun 30, 2018 interface, 1291 Views
This Program is used to demonstrate the Interface concept.
using System;

interface shape

  {

    void area();

  }

public class square : shape

  {

    public int i;

    public void area()

      {      

         Console.Write("\nEnter the Side : ");

         i = int.Parse(Console.ReadLine());

         Console.WriteLine("\nArea of Square is : {0}",(i*i));

      }

  }

public class circle : shape

  {

    public double i;

    public void area()

      {      

         Console.Write("\n\nEnter the Radius : ");

         i = double.Parse(Console.ReadLine());

         Console.WriteLine("\nArea of Circle is : {0}",(3.14*i*i));

      }

  }



public class exam

  {

     public static void Main()

       {

           shape s;

           square k  = new square();

           circle c = new circle();

           s=k;

           k.area();

           s=c;

           c.area();                       

       }

 } 
A to Z Full Forms and Acronyms

Related Article