Introduction
- Overloading and Overriding are parts of Polymorphism.
- Overloading is compile time polymorphism, also known as Early Binding or Static Binding.
- Overriding is run-time polymorphism, also known as Late Binding or Dynamic Binding.
So first we'll go through the Overloading
Suppose you need to define a method, but you don't have any idea of how many parameters would be there and also don't know the what type of data it would be.
Let's take a method named Insert_Employee.
class Insert_Employee_Data { public static void Insert_Employee(int EmployeeID) { // Inserts EmployeeID as given and Employee's FirstName and LastName as empty } public static void Insert_Employee(int EmployeeID, string FirstName) { // Inserts EmployeeID and Employee Name as given whereas, LastName as empty } public static void Insert_Employee(int EmployeeID, string FirstName, string LastName) { // Inserts EmployeeID, Employee's FisrtName and LastName as given } 
Join the conversation! Your thoughts help the community grow.