|
||
|
Lesson 3
Objective
|
Conversion and overloading Difference between conversion and overloading. |
|
|
In the first part of this course, we will be focusing on ad hoc polymorphism, which has two forms:
Conversion
Conversion is the explicit or implicit change of value between types. A function or operator works on several different
types by converting their values to the expected type. For example, a default constructor is by de facto a type conversion from
the argument's type to the constructor's class type.
Overloading
Overloading of functions or operators gives the same function name or operator different meanings. When a function is
overloaded, the same function name has different interpretations that depend on its signature--the list of argument
types in the function's parameter list. When an operator is overloaded, the operator has different meanings depending on
the types of its operands.
In this module, we will be looking at both conversion and function overloading in greater detail. Operator overloading is more involved and will be covered in a later module. |
||
|
|
||