Oriented Programming. 5 marks
Ans Object Oriented paradigm: The Object Oriented paradigm is centered on the concept of the object.
Everything is focused on objects. In this language, program consists of two things: first, a set of objects and second the way they interact with each other. Computation in this paradigm is viewed as the simulation of real world entities. The popular programming languages in this paradigm are C++, Simula,
Smalltalk and Java
Object Oriented programming: The world is Object Oriented, and Object Oriented programming expresses programs in the ways that model how people perceive the world. Figure 2 shows different real world objects around us which we often use for performing different functions. This shows that problem solving using the objects oriented approach is very close to our real life problem solving techniques.
The basic difference in Object Oriented programming (OOP) is that the program is organized around the data being operated upon rather than the operations performed. The basic idea behind OOP is to combine both, data and its functions that operate on the data into a single unit called object.
Object Oriented methods are favored because many experts agree that Object Oriented techniques are more disciplined than conventional structured techniques. (Martin and Odell 1992)
b) What is polymorphism? Explain the advantages of polymorphismwith an example.
Solution : Polymorphism is the capability of a method to do different things based on the object through which it is invoked or object it is acting upon. For example method find _area will work definitely for Circle object and Triangle object In Java, the type of actual object always determines method calls; object reference type doesn't play any role in it. You have already used two types of polymorphism
(overloading and overriding) in the previous unit and in the current unit of this