Object Oriented Basic Concepts
Object-Orientation:
- Its called object orientation because that contain the things related of real word.
- A table is a object,like a cycle,a human being etc all are the objects.
- In every day life, we uses a so many objects,and we work with model.
- For ex. we uses a model to describe a reality.
Basic Concepts of OOP:
- Object
- Classes
- Encapsulation
- Abstraction
- Inheritances
- Polymorphism
- Dynamic binding
- Messaging
Object:
- It is a basic run time entity.
- It contain data and properties(methods) that can manipulate a information.
- The object is communicate with each other and programming problem analysed.
Example:
- If FERRARI is a one object that contain following data and properties.
- Object contain data and methods.
- The class is contain the entire set of data and methods.
- Objects are variable type class.
- A class is collection of similar types.
Example:
Rose, Lotus,Marigolds etc members of the class Flowers.
Flower Rose
will create an object Rose belong to the Fruit Class.
Encapsulation:
- The wrapping data into a one single unit is called Encapsulation.
- Its most important and striking feature of class.
- The function provide the interface between the objects data and program.This insulation of the data from direct access by the program is called Data hiding.
Example:
The capsule contain all required elements in under that cover. That are in Fig.
Abstraction:
- Only represent required and essential features.
- Hides the background details or explanations.
- They encapsulates all essentials properties f an object.
Example:
The calculator solves son many equations but it no gives no extra details like how calculates, which formula uses etc.
Inheritance:
- Object of one class can acquire features of another one class.
- That's mean the objects inherits the properties and methods from another class
- It supports to the re-usability feature of the OOP. Because the new class can easily give a access of their old class.
- As well as the new class allows added their own some features.
- The old class referred as base class and new class referred as derived class.
Example:
In fig the cub extends the features of Lions.
Polymorphism:
- Ability to take more than one form.
- An operation may exhibits different behaviors in different instances,The behavior depends upon the types of data used in the operation.
- Polymorphism is extensively used in implementing inheritance.
Example:
The boys plays various role in their life.
- In shopping center he act as a customer.
- In the bus as a passenger
- In school as a student.
- In home as a son..
Dynamic binding:
- It known as Run time binding or Dynamic binding.
- Binding means link between procedure call and code to be executed.
- At run-time, the code corresponding to the project under current reference will be called or executed.
- It also called late binding.
Example:
Consider the procedure of boy in polymorphism in above fig. by inheritance , every object will have this procedure. Its algorithm is unique for each object and the perform their task in each class that defines the object.
Message passing:
- Object oriented programming communicate with each other,message passing is used foe communication between objects.
- It involves following basic steps:
- Creating classes with data , methods
- Creating objects of class
- Establishing commutation among them
Comments
Post a Comment