You can't inherit multiple classes at a time. But there is an options to do that by the help of interface
using System;
namespace ConsoleApplicationSample
{
class ArrayBCA
{
#region Interface
interface IA
{
void PrintIA();
}
class A : IA
{
public void
PrintIA()
{
Console.WriteLine("PrintA method in Base Class
A");
}
}
interface IB
{
void PrintIB();
}
class B : IB
{
public void
PrintIB()
{
Console.WriteLine("PrintB method in Base Class
B");
Console.ReadLine();
}
}
public class AB : IA, IB
{
A a = new A();
B b = new B();
public void
PrintIA()
{
a.PrintIA();
}
public void
PrintIB()
{
b.PrintIB();
}
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos
0 comments
Post a Comment