Implicitly Implement Interface Concept In C Sharp
using System;
interface Rectangle
{
void AreaOfRectangle();
}
interface Parallelogram
{
void AreaOfParallelogram();
}
class ImplicitlyInterfaceConcept : Rectangle, Parallelogram
{
int area;
public void AreaOfRectangle()
{
int i_length =20, i_width= 10;
area = i_length * i_width;
Console.WriteLine("Area Of Rectangle is " + area);
}
public void AreaOfParallelogram()
{
int i_base = 10, i_height=50;
area = i_base * i_height;
Console.WriteLine("Area Of Parallelogram is " + area);
}
static void Main()
{
ImplicitlyInterfaceConcept iic_obj = new ImplicitlyInterfaceConcept();
Rectangle rec_obj = (Rectangle)iic_obj;
rec_obj.AreaOfRectangle();
Parallelogram par_obj = (Parallelogram)iic_obj;
par_obj.AreaOfParallelogram();
}
}
----------------------------------------------------------------------------------------------------
Implicitly Implement Interface Concept In C Sharp
Reviewed by Baljeet Singh
on
06:06
Rating:
No comments: