Hi all,
I have one base class and 2 derived class and one method say xyz.
in base class i declare xyz as virtual, but i want to override to
override this method in derived2 class and not in derived1 class. but
in derived1 class i want method with same name that is 'xyz'. but don't
want to override here. means say i have following code
class base1
{
public virtual void xyz()
{
System.Console.WriteLine("base1 xyz");
}
}
class derived1 : base1
{
public void xyz()
{
System.Console.WriteLine("derived1 xyz");
}
}
class derived2 : derived1
{
public override void xyz()
{
System.Console.WriteLine("derived2 xyz");
}
}
Above code is giving me error. Can anyone tell me why this is
happening. Can't i override base class method in derived2 .
Plese correct me if i am wrong.
thanks in advance.