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.
Dear User, We are grateful for your interest in the Kodingwindow Android app. We intend to soon make it available on the Google Play Store. Currently, Android versions 10 and up require manual apk installations. Would you like to get the app?