KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
class Base { public virtual void MethodA(int x) { Console.WriteLine ("In Base Class"); } } class Derived : Base { public override void MethodA(int x) { Console.WriteLine ("In derived INT)"); } public void MethodA(object o) { Console.WriteLine ("In derived OBJECT"); } } class Test { static void Main() { Derived d = new Derived(); int k = 20; d.MethodA(k); } } The output I got for this is " In derived OBJECT ". What is the reason for this strange behaviour? After some research, I found out the reason is the signatures declared in the base class are ignored . Why are they ignored?
Tags (comma-separated)
Save Edits
Cancel