Created
November 10, 2019 15:20
-
-
Save NeelBhatt/ebafc46a5cb28777bba3e1637147c3bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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