Getting Following Error in Polymorphism
I'm getting this error in my C# Code as I'm New to C-Sharp, So I'm Struggling to Fix this One.
Here's the Error Am Getting:
Getting Following Error in Polymorphism
I'm getting this error in my C# Code as I'm New to C-Sharp, So I'm Struggling to Fix this One.
Here's the Error Am Getting:
As the error message says, you need to use the new keyword if you want to replace the implementation from the parent class.
public new void animalSound()
This is not an error. It is a warning. Using "new" keyword in method declaration as
public new void animalSound()
will silence the warning. But, it is better to understand what is going on. Refer to this Microsoft documentation to understand this warning as well as the difference between using "new" and "override" keywords in C# polymorphism.