/* related posts with thumb nails */

concepts of OOPS:

OOPS stands for Object Oriented Programming System. It is the most popular approach followed by programming languages. Java is one such language which follows OOPS. It supports the following concepts:

Data Encapsulation: Encapsulation means “combining”. This feature allows you to combine several related properties (attributes) and functions (methods) into a single unit as its members. The members of that unit are accessible to its instances depending up on their accessibility conditions.

Consider the following example: A single unit encapsulating name, rno, marks, getdata(), and showdata() as its members.

Data Hiding: This feature allows you to make the members of a class not accessible outside. In Java, the accessibility of the members can be controlled by the keywords public, private and protected. When the members are private they are said to be hidden members i.e. not accessible outside the class.

Data Abstraction: It is a mechanism to create new data types that include several related operations to be performed on it and attributes to suit the requirements of an application. In Java, Classes are written to prepare ADTs (Abstract data types).

Abstraction is an ability to represent a class in shortest possible form. To achieve this developer hides implementation details of the functions but provides list of member variables and prototypes of member functions.

Inheritance: This feature allows you to derive the properties of an existing object. It allows extending operations on an object by inheriting the existing properties instead of writing everything from scratch.

Polymorphism: It means “many forms”. Different behavior of functions or operators or objects at different situations can be called as “polymorphism”. Polymorphism can be exhibited in three different ways: Function Overloading, Operator overloading and Dynamic binding.

§ Function Overloading: It allows you to have any number of functions with the same name provided they take different number of arguments or different types of arguments. The following functions take same name but they have different number of arguments.



§ Operator Overloading: Creating new meaning to the existing operators is operator overloading. In the following example the operator ‘+” is used in two expressions. But the way it behaves (adds) is different.

30 + 40 = 70

“Ravi” + “Varma”

Note: Java does not support explicit operator overloading.

§ Dynamic binding: Linking objects at run-time is dynamic binding. In the following example the object “s1” draws “ rectangle or circle depending on the object what it is linked to; when it invokes the “draw()” method.

Shape S1;

S1= new rect();


S1 = new tri();


Message Passing (communication): An object-oriented program consists of a set of objects that communicate with each other. The process of programming in an object-oriented language, therefore, involves the following basic steps:

1. Creating classes that define objects and their behavior.

2. Creating objects from class definitions.

3. Establishing communication among objects.

Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another

Related Topics:


Post a Comment