Console.WriteLine("———————————————————————————————————————————");Console.WriteLine("Program to demonstrate the use of interface");Console.WriteLine("———————————————————————————————————————————");WhiteBankwb=newWhiteBank();GreenBankgb=newGreenBank();gb.credit();wb.withdraw();Console.Write("———————————————————————————————————————————");publicinterfaceIBank{voidcredit();voidwithdraw();}publicclassWhiteBank:IBank{publicvoidcredit(){Console.WriteLine("Your balance is credited in WhiteBank account");}publicvoidwithdraw(){Console.WriteLine("\nCash withdrew from WhiteBank account");}}publicclassGreenBank:IBank{publicvoidcredit(){Console.WriteLine("Your balance is credited in GreenBank account");}publicvoidwithdraw(){Console.WriteLine("\nCash withdrew from GreenBank account");}}
Output
kodingwindow@kw:~/csharp$ dotnet run
———————————————————————————————————————————
Program to demonstrate the use of interface
———————————————————————————————————————————
Your balance is credited in GreenBank account
Cash withdrew from WhiteBank bank account
———————————————————————————————————————————
kodingwindow@kw:~/csharp$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.