Base Class Method As Interface Implementation C# with Example



Base Class Method As Interface Implementation C# with Example

 using System;

namespace CSharpInterface
{
	interface IDisplay { void Display(string s); }
	
    public class BaseClass
    {
        public void Display(string s)
        {
            Console.WriteLine("Called via {0}", s);
        }
    }
	
    public class DerivedClass : BaseClass, IDisplay{}

    class MultipleInterfaceImplementation
    {
        public static void Main(string[] args)
        {
            DerivedClass obj = new DerivedClass();
            obj.Display("Derived Class Object");
        }
    }
}
 

0 Comment's

Comment Form