Java Lecture 2:OOPS

Basic concepts of object oriented programming

·         Objects

·         Classes

·         Data Abstraction

·         Encapsulation

·         Data Hiding

·         Inheritance

·         Over Loading

·         Polymorphism

·         Binding

·         Message Passing

Objects

Objects are the basic run-time entities in object- oriented system. An Object is an entity that has state, behaviour and identity. There are many objects around us. E.g. A computer mouse, is an object. It is considered an object with state and behaviour. Its states would be its colour, size and brand name and its behaviour would be left-click, right- click.

Classes

A class is an entity that helps the programmer to define a new complex data type. Objects are the variables of type class. A class defines the data and behaviour of objects. In simple words, A class is a collection of objects of similar type. E.g. mango, apple and orange are members of the class fruit.

Data Abstraction

Data Abstraction refers to the act of re- presenting essential features without including the back-ground details. It is concerned with separating the behaviour of a data object from its re-presentation. E.g. Executable file of a program.

Encapsulation

The process of binding data members and functions in a class is known as, encapsulation. Here data is not accessible to the outside world, only those functions which are declared in the class, can access it. Security for the language is established through this

Data Hiding

                Data Hiding is similar to encapsulation. Basically, encapsulating data members and functions in a class promotes data hiding.

 

Inheritance

Inheritance is a process by which objects of new class acquire the properties of objects of existing (base) class. The concept of inheritance provides the idea of re-usabilityThis means that we can add additional features to an existing class without modifying it.

Over-Loading

                Object-Oriented Programming also provides a facility to extend the meaning of available functions and operators. Assigning an extra meaning to an existing operator or a function is known as Over-Loading.

Polymorphism

It is a Greek term, means the ability to take more than one form.The process of making an operator to show different behaviours in different instances is known as operator-overloading. Using a single function name to perform different types of tasks is known as function-overloading.

Binding

Binding refers to the linking of a procedure call to the code (its body) to be executed in response to the call.In Object-Oriented Programming, Binding is of two types :  Static Binding and Dynamic Binding

Static Binding :

Linking of a function call to its body at the compile time is known as static binding. It is also known as early binding.

Dynamic Binding :

Linking of a function call to its body during run-time is known as static binding. It is also known as late binding.

Message Passing

In OOPs, objects communicate with one-another by sending and receiving information similar as people send messages to and fro.

Message Passing involves specifying the name of the object, the name of the function and the information to be send.

 

 


No comments:

Post a Comment