using System;

namespace abstract_class
{

    public abstract class Polygon { 
  
    // abstract method 'howmanysides()' 
        public abstract void howmanysides();       
    } 

    public class Triangle : Polygon
{ 
    public override void howmanysides()
    { 
        Console.WriteLine("Triangle: I have 3 sides"); 
    } 
} 

public class Square : Polygon
{  

    public override void howmanysides()
    { 
        Console.WriteLine("Square I have 4 equal sides with 90 degree right angles"); 
    } 
} 

public class Pentagon : Polygon
{  

    public override void howmanysides()
    { 
        Console.WriteLine("Pentagon: I have 5 sides"); 
    } 
}

public class Hexagon : Polygon
{  
    public override void howmanysides()
    { 
        Console.WriteLine("Hexagon: I have 6 sides"); 
    } 
}

public class Quadrilateral : Polygon
{  
    public override void howmanysides()
    { 
        Console.WriteLine("Quadrilateral: I have 4 sides"); 
    } 
}

public class Rectangle : Polygon
{  
    public override void howmanysides()
    { 
        Console.WriteLine("Rectangle: I have 4 sides, 2 short and 2 long"); 
    } 
}

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("");
            Polygon p; 
            p = new Triangle();            
            p.howmanysides();

            p = new Square();            
            p.howmanysides();

            p = new Pentagon();            
            p.howmanysides();

            p = new Hexagon();            
            p.howmanysides();

            p = new Quadrilateral();            
            p.howmanysides();

            p = new Rectangle();            
            p.howmanysides();
            Console.WriteLine("");

        }
    }
}

Triangle: I have 3 sides
Square I have 4 equal sides with 90 degree right angles
Pentagon: I have 5 sides
Hexagon: I have 6 sides
Quadrilateral: I have 4 sides
Rectangle: I have 4 sides, 2 short and 2 long