(Object Oriented Programming) : CCS0023L
(Object Oriented Programming) : CCS0023L
CCS0023L
(Object Oriented Programming)
EXERCISE 7
Dealing with Polymorphism and Inheritance
Student Name /
Group Name:
Name Role
Section:
Professor:
•
Polymorphism is the ability of different objects to respond to the same message in different
ways. This means that different objects can have very different method implementations for the
same message.
Method Overloading is the process of declaring methods with the same name but different
parameter types.
Method Overriding allows a subclass to redefine methods of the same name from a superclass
V. EXPERIMENTAL PROCEDURE:
•
2. Give a definition of a class named Arithmetic whose methods are three add() and multiply()
and one subtract() and divide().
• Parameter for add() and multiply() should be two, three and four int respectively.
• Parameter for subtract() and divide() should be two int.
• Applying method calling in the main(), test your program by calling the following
methods:
add(1,3) add(1,3,4,5)
multiply(2,3,4)
multiply(1,1)
subtract(3,1)
divide(5,2)
• Main
VI. QUESTION AND ANSWER: