Unit-I Chapter in Book - 7 Overloading: - K. Indhu
Unit-I Chapter in Book - 7 Overloading: - K. Indhu
CHAPTER IN BOOK- 7
OVERLOADING
-K. Indhu
K. INDHU
GOALS
1. Overloading Methods
2. Method Overloading- Definition &
Example
3. Automatic Conversions in Overloading
4. Polymorphism
5. Overloading Constructors
6. Passing Object as Parameter
7. Copying One Object into another
K. INDHU
I.
OVERLOADING METHODS
DEFINITION- METHOD
OVERLOADING
THUS DEFINITION
of METHOD OVERLOADING>
Possessing 2 or more methods, with same
name but different signatures inside the same
class is called as METHOD OVERLOADING.
It is to be noted that Signature of method
includes(i) Parameter numbers,
(ii) Parameter Data Types and,
(iii) Order of Parameters.
K. INDHU
EXAMPLE- METHOD
OVERLOADING
EXAMPLE- METHOD
OVERLOADING
K. INDHU
AUTOMATIC CONVERSIONS
OVERLOADING
K. INDHU
POLYMORPHISM
EXAMPLE ->
1. Javas standard class library includes an absolute value
method, called abs( ).
2. This method is overloaded by Javas Math class to handle
all numeric types.
3. Java determines which version of abs( ) to call based
upon the type of argument.
K. INDHU
OVERLOADING CONSTRU
K. INDHU
OVERLOADING CONSTRU
K. INDHU
11
PASSING OBJECT AS
PARAMETER
K. INDHU
K. INDHU
K. INDHU
K. INDHU
SO FAR WE STUDIED
Overloading
K. INDHU
HAPPY
LEARNING!!!