C# program to demonstrate interface implementation with multi-level inheritance
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
The source code to demonstrate interface implementation with multi-level inheritance is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
Here, we created an interface MyInf that contains the declaration of Method1(). Then we implemented the interface in the Sample1 class. After that, we created multi-level inheritance with the help of Sample1, Sample2, and Sample3 classes. Each class contains one method.
Now look to the Program class, It contains the Main() method, the Main() method is the entry point for the program. Here we created the object of Sample3 class and called all methods that will print the corresponding message on the console screen.