Is polymorphism another term for overloading?
overloading, polymorphism, terminology
Solution
No; overloading is creating a method with the same name with a different amount of parameters, or with parameters which are of another type.
Polymorphism is about changing the implementation / functionality of a specific method across various types (which all have the same 'base-type').
Overloading:
public class TestClass
{
public void DoSomething( int a, int b ) {}
public void DoSomething( int a, int b, string x ) {}
}
Polymorphism:
public abstract class Base
{
public abstract DoSomething();
}
public class A : Base
{
public override DoSomething()
{
Console.WriteLine("I am A");
}
}
public class B : Base
{
public override DoSomething()
{
Console.WriteLine("I am B");
}
}
Problem
Is polymorphism another term for overloading?