I have the following classes:
class SearchEngine
{
public virtual void Search()
{
Console.WriteLine("Base Class");
}
}
class Google: SearchEngine
{
public override void Search()
{
Console.WriteLine("Google Class");
}
}
class Yahoo: SearchEngine
{
public new void Search()
{
Console.WriteLine("new method in Yahoo Class");
}
}
And I call them this way:
SearchEngine s1 = new SearchEngine();
SearchEngine s2 = new Google();
SearchEngine s3 = new Yahoo();
s1.Search();
s2.Search();
s3.Search();
And I get the following results:
Base Class
Google Class
Base Class
My question is how to access the Search()
method from the Yahoo
class?
(And yes I know this is a bad idea to use the new
keyword like this and I know this not overriding a class)