Answer the question
In order to leave comments, you need to log in
How to inherit from 2 abstract C# classes?
Good afternoon. I'm just learning C #, I got an interesting problem, please tell me how to solve it.
There are 2 interfaces that are inherited in abstract classes (cars and planes). The task is to describe the 3rd abstract class that inherits 2 classes (Ilona Mask's machine). Let's say there is multiple inheritance in C++, but how to do it in c#? The code is described below, thanks in advance.
interface ICar
{
void Move();
}
interface IPlane
{
void Fly();
}
abstract class StandartCar: ICar
{
public int wheel { get; set; }
public int doors { get; set; }
public void Move()
{
Console.WriteLine("60 km/h");
}
}
abstract class StandartPlane: IPlane
{
public int wings { get; set; }
public void Fly()
{
Console.WriteLine("500 km/h");
}
}
abstract class MaskCar: ICar, IPlane
{
}
Answer the question
In order to leave comments, you need to log in
The task is to describe 3 abstract classes that inherit 2 classes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question