Animal a2 = new Dog(); meansi want to understand in depthAnimal a2 = new Dog(); a2.Talk(); a2.Sing(); a2.Greet(); //Output Animal constructor Dog constructor Animal talk Dog song Animal says Hellowhy above output is coming when we have used new dog().... public new void Talk() what does this line mean in class dog below
class Animal { public Animal() { Console.WriteLine("Animal constructor"); } public void Greet() { Console.WriteLine("Animal says Hello"); } public void Talk() { Console.WriteLine("Animal talk"); } public virtual void Sing() { Console.WriteLine("Animal song"); } };class Dog : Animal { public Dog() { Console.WriteLine("Dog constructor"); } public new void Talk() { Console.WriteLine("Dog talk"); } public override void Sing() { Console.WriteLine("Dog song"); } };and what is abstract and interface are ? why both exist when both does almost same thing