using System;
namespace ProgramDemo
{
class A
{
public int Add()
{
return 8 + 9;
}
}
class B:A
{
public int Add()//Warning
{
return 5 + 5;
}
public int Add1()//Warning
{
return 9 + 5;
}
}
class C:B
{
public int Add()//Warning or you have to give new keword
{
return 4 + 4;
}
}
class Program
{
static void Main(string[] args)
{
A a = new A();
A ab = new B();
A ac = new C();
// B ba=new A()->Error
B b = new B();
B bc = new C();
C c = new C();
Console.WriteLine(a.Add());
Console.WriteLine(ab.Add());
Console.WriteLine(ac.Add());
Console.WriteLine(b.Add());
Console.WriteLine(b.Add1());
Console.WriteLine(bc.Add());
Console.WriteLine(c.Add());
Console.ReadLine();
}
}
}
namespace ProgramDemo
{
class A
{
public int Add()
{
return 8 + 9;
}
}
class B:A
{
public int Add()//Warning
{
return 5 + 5;
}
public int Add1()//Warning
{
return 9 + 5;
}
}
class C:B
{
public int Add()//Warning or you have to give new keword
{
return 4 + 4;
}
}
class Program
{
static void Main(string[] args)
{
A a = new A();
A ab = new B();
A ac = new C();
// B ba=new A()->Error
B b = new B();
B bc = new C();
C c = new C();
Console.WriteLine(a.Add());
Console.WriteLine(ab.Add());
Console.WriteLine(ac.Add());
Console.WriteLine(b.Add());
Console.WriteLine(b.Add1());
Console.WriteLine(bc.Add());
Console.WriteLine(c.Add());
Console.ReadLine();
}
}
}
No comments:
Post a Comment