How to use the new modifier in hiding base class method?

Thursday, July 9, 2009


using System;
using System.Collections.Generic;
using System.Text;

namespace OOPs21
{
class BaseClass
{
public string ShowMe()
{

return "base";
}
}
class DerivedClass : BaseClass
{
public new string ShowMe()
{

return "derive";
}


public static void Main()
{
DerivedClass vardc = new DerivedClass();
Console.Write(vardc.ShowMe());
Console.ReadLine();
}

}
}



www.codecollege.NET

0 comments

Post a Comment

LinkWithin

Blog Widget by LinkWithin

Recommended Books