in c++ when we use operator overloading
we actualy change the name of any function into a operator like +,-,*,/ .
the function is declared:
return operator +(parameters)
in the programe
when we need to call it
class type a,b,c;
in polymorphism we can defined different name for same entity.
Which is the difference between overloading and polymorphism?
The difference between polymorphism and method overloading is in the time when the actual method to execute is determined. The reason for this is that when a method is overloaded, such as in:
account = new BankAccount();
account = new BankAccount(1000);
The compiler can tell which constructor to use by the method signature, including the number and types of parameters provided. This selection of a method to use at compile time, before the program ever runs is called early binding.
Overloading is a type of polymorphism(more like a branch of it). Better still, let me put it this way:
polymorphism in the context of object-oriented programming, is the ability to create a variable, a function, or an object that has more than one form.
The terms overloading may refer constructor and method overloading, in computer science, a type of polymorphism where different functions with the same name are invoked based on the data types of the parameters passed.
i have made their similarities in bold so you can easily pick on that. Having said this, you may come across things like function overloading, operator overloading and so on.