MCQs > IT & Programming > C# > Having the following code , what will be the result ? public class Animal { public void Walk() { Console.WriteLine('Animal is walking'); } } public class Dog : Animal { public new void Walk() { Console.WriteLine('Dog is walking'); } } void Main() { Animal cat = new Animal(); Dog dog = new Dog(); Animal adog = new Dog(); cat.Walk(); dog.Walk(); adog.Walk(); }

C# MCQs

Having the following code , what will be the result ? public class Animal { public void Walk() { Console.WriteLine("Animal is walking"); } } public class Dog : Animal { public new void Walk() { Console.WriteLine("Dog is walking"); } } void Main() { Animal cat = new Animal(); Dog dog = new Dog(); Animal adog = new Dog(); cat.Walk(); dog.Walk(); adog.Walk(); }

Answer

Correct Answer: Animal is walking Dog is walking Animal is walking

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

More C# MCQ Questions

search

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it