I don't understand why my output is not how I think it should be. I think that it should be Dog barks line break Cat meows. But there is nothing there.
Code:
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Pets pet1 = new Dog();
Pets pet2 = new Cat();
pet1.Say();
pet2.Say();
Console.ReadKey();
}
}
class Pets
{
public void Say() { }
}
class Dog : Pets
{
new public void Say() { Console.WriteLine("Dog barks."); }
}
class Cat : Pets
{
new public void Say() { Console.WriteLine("Cat meows."); }
}
}
I have tried to go through the c# programming guide on MSDN but I find it very difficult to understand some of the examples on there. If someone could link to a good "inheritance for dummies" site, it would be much appreciated.