Skip to content

Instantly share code, notes, and snippets.

@NeelBhatt
Created November 10, 2019 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeelBhatt/ebafc46a5cb28777bba3e1637147c3bc to your computer and use it in GitHub Desktop.
Save NeelBhatt/ebafc46a5cb28777bba3e1637147c3bc to your computer and use it in GitHub Desktop.
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