Решение:
//Write a class C2 that inherits all the functionality of A2 and B2,
//with the same stipulation that it should take f() from A2 and g() from B2.
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
C2 c2 = new C2();
c2.f();
c2.g();
}
}
public class A2
{
public void f()
{
Console.WriteLine("Call f() from class A2");
}
}
public class B2 : A2
{
public void g()
{
Console.WriteLine("Call g() from class B2");
}
}
public class C2 : B2
{
public C2()
{
Console.WriteLine("Create class C2");
}
}
}
|