Sunday 4 December 2016

C# Interface: Implementing Multiple Inheritance


using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;

namespace Interface
{
interfaceParent
    {
voidParentMethod();
    }
interfaceChild
    {
voidChildMethod();
    }
classMainClass : Child , Parent
    {
publicvoidChildMethod()
        {
Console.WriteLine("Child Interface executed");
        }
publicvoidParentMethod()
        {
Console.WriteLine("Parent Interface Execcuted");
        }
publicstaticvoid Main()
        {
MainClass mc = newMainClass();
mc.ParentMethod();
mc.ChildMethod();
Console.ReadLine();
        }
    }
}

OUTPUT:

        Parent Interface Executed

        Child Interface executed

No comments:

Post a Comment