go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Features of OOP
 
Subject: Features of OOP
Author: Alex_Raj
In response to: Object-oriented programming (OOP)
Posted on: 12/03/2013 06:59:31 AM


Encapsulation Enforces Modularity and Reusibility

Encapsulation refers to the creation of self-contained modules that bind processing functions to the data. These user-defined blueprint module is called "class" and all instances of a class are called "objects". For example, a Employee class specifies data fields like name, address and telephonenumber. Alice and Bob are two objects of Employee class.


Inheritance Passes "Knowledge" Down

Inheritance is the creation of one class, called the derived (or child) class, from
another class called the base (or parent) class. The derived class has all the features of the base class, plus some additional features. For example, Secretary class might be derived from a more general Employee class, and includes a data member called typingSpeed that Employee class lacked.

Inheritance lets the structure and methods in one class pass down the hierarchy. That means less programming is required when adding functions to complex systems. The ability to reuse existing objects is considered a major advantage of object technology.



Polymorphism Takes any Shape

Polymorphism involves treating objects of different classes in the same way. For polymorphism to work, these different classes must be derived (inherited or implemented) from the same base class or interface.

For example, a base class Animal's method speak() can trigger runtime binding objetcs' different behavior of speaking: "WongWong" for Dog and "MewMew" for Cat.

Polymorphism lets programmers create procedures for objects whose exact type is not known until runtime. Polymorphism simplifies and clarifies program design and coding.


 

> On 12/03/2013 06:50:29 AM Alex_Raj wrote:


Object-oriented programming (OOP) is a programming that represents concepts as objects that have data fields and associated procedures known as methods. The focus of OOP is on data. Objects can be thought of as encapsulating their data with a set of functions designed to ensure that the data are used appropriately.





References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.