Question: C# programing Multiple Inheritance using Interface-Part 2 Create a class Bat and implements interfaces Mammal and WingedAnimal . Also, override methods in Bat class, a
C# programing
Multiple Inheritance using Interface-Part 2
Create a class Bat and implements interfaces Mammal and WingedAnimal.
Also, override methods in Bat class, a method eat() of interface Animal which display Bat can eat, a method breathe() of interface Mammal which display Bat can breathe and a method flap() of interface WingedAnimal which display Bat can fly.
Note: Animal, Mammal and WingedAnimal interfaces already created.
Output Bat can eat Bat can breathe Bat can flap
Note: Here no new line after last line Bat can flap.
Please fill in the partial code below:
using System; using System.Collections.Generic; using System.Linq;
//write your code here
interface Animal { void eat (); } interface Mammal : Animal { void breathe (); } interface WingedAnimal : Animal { void flap (); }
class DriverMain {
public static void Main () { Animal animal = new Bat (); animal.eat (); Mammal mammal = new Bat (); mammal.breathe (); WingedAnimal wingedAnimal = new Bat (); wingedAnimal.flap (); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
