G
gkrish
using System;
public class Animal
{
public string Sleep() { return "Animal::Sleep"; }
}
public class Fish : Animal
{
new public string Sleep() { return "Fish::Sleep"; }
[STAThread]
static void Main(string[] args)
{
Animal objFish = new Fish();
Console.WriteLine(objFish.Sleep());
}
}
In the above case I still get "Animal::Sleep" in the output but I expected
Fish:Sleep on account of the modifier new.
Can anyone explain ?
Thanks
GK
public class Animal
{
public string Sleep() { return "Animal::Sleep"; }
}
public class Fish : Animal
{
new public string Sleep() { return "Fish::Sleep"; }
[STAThread]
static void Main(string[] args)
{
Animal objFish = new Fish();
Console.WriteLine(objFish.Sleep());
}
}
In the above case I still get "Animal::Sleep" in the output but I expected
Fish:Sleep on account of the modifier new.
Can anyone explain ?
Thanks
GK