go to  ForumEasy.com   
JavaPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » Java Programming » Object-oriented programming (OOP)
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: Object-oriented programming (OOP)
Alex_Raj
member
offline   
 
posts: 99
joined: 05/16/2006
from: San Jose, CA
  posted on: 12/03/2013 06:50:29 AM    Edit  |   Quote  |   Report 
Object-oriented programming (OOP)
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.

 Profile | Reply Points Earned: 0
Alex_Raj
member
offline   
 
posts: 99
joined: 05/16/2006
from: San Jose, CA
  posted on: 12/03/2013 06:59:31 AM    Edit  |   Quote  |   Report 
Features of OOP

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.

 Profile | Reply Points Earned: 0

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