Skip to content

Instantly share code, notes, and snippets.

@NeelBhatt

NeelBhatt/modifiers

Created Nov 10, 2019
Embed
What would you like to do?
using System;
interface IInterfaceModifiers
{
//By Default default method is private
virtual void DefaultMethod()=>Console.WriteLine("Default method");
//Private Default Method
private void privatedefaultmethod()=>Console.WriteLine(" private Default method");
//Protected Default Method
protected void ProtectedDefaultMethod()=>Console.WriteLine(" protected Default method");
// Public Default Method
public void PublicDefaultMethod()=>Console.WriteLine(" public Default method");
virtual void VirtualDefaultMethod()=>Console.WriteLine("Virtual Default method");
abstract void AbstractDefaultMethod();
}
class InterfaceModifierDemo : IInterfaceModifiers
{ public void AbstractDefaultMethod() => Console.WriteLine("Abstract virtual method");}
namespace DeaultInterfaceDemo
{
class Program
{
static void Main(string[] args)
{
IInterfaceModifiers i= new InterfaceModifierDemo();
i.AbstractDefaultMethod();
i.DefaultMethod();
i.PublicDefaultMethod();
i.VirtualDefaultMethod();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment