Polymorphism concept using C# Language.
Jun 30, 2018
Polymorphism,
1216 Views
This Program is used to demonstrate Polymorphism concept.
using System;
.
public class shape
{
public void area(double r)
{
double a;
a = (3.14 * r * r);
Console.WriteLine("\nArea of Circle is : {0}",a);
}
public void area(double b, double h)
{
double a1;
a1 = (0.5 * b * h);
Console.WriteLine("\nArea of Triangle is : {0}",a1);
}
public static void Main()
{
shape s = new shape();
s.area(3.2);
s.area(4,5);
}
}