C# interface – programs for practice

(Last Updated On: February 26, 2019)

Q) What is output of C# code?

View Answer
Output:
Saving Account
Process saving account
Explanation: Saving Account class inherits an interface and implement its methods in the class. Note that if a class inherits an interface in C# programming, then class must implement all the methods and properties of interface or interfaces if we inherit multiple interfaces. You can read C# interface with example and how to use multiple interfaces in C# program.

Q) What is output of below C# program example?

Output:

  1. Compiler error as C# multiple inheritance is not supported.
  2. Connect database, processing transaction
View Answer
Answer: B
Program is absolutely correct, in C# object oriented programming, we can inherit one class and multiple interfaces.So, Program will output correctly as per methods call. You can see more about multiple interface inheritance in C Sharp with example and explanation.