Object Oriented Programming
All are things in the world are objects. We can identify
these things easily but we don’t care about their inside.
This is the fact to introduce Object Oriented Programming. In
a program, we can use a system as an object. It is easy to solve problems in
programming because object abstracts the entire thing and represent as a unit.
In an object, data are covered by methods. So other objects cannot connect with
data directly.
There are some features in this Object Oriented Programming.
- We can divide a program to many objects.
- We can add new data and methods easily on the time.
- Data are hidden and external things cannot connect with them.
- Data highlight than process.
Basic Concepts of object oriented programming
1. Object and Class
Object: Object is the thing which we can see and touch. In
the programming these are the basic units. An object has three parts.
- Identify: A name to identify from others.
- State: Properties of the object.
- Behaviors: Things that the object can do.
Example : Postman
State:
Uniform, Letters, Post-cards, Post-bag
Behaviors:
Deliver post-cards and letters, Open
the public post boxes
Class: Objects with same structure and behavior are
categorized into a class. A class has objects with same template. So we can introduce a class as a template. We
use a class to add new object to the program.
2. Abstraction
Abstraction is the process that knows which
details to hide away and which to present. Hides details are not important in
programming. This is useful to deal with complex problems.
3. Encapsulation
Encapsulation is a method of abstraction. Wrapping methods
and data together into a single unit is known as encapsulation.
In programming, we use “private” code to encapsulation.
Encapsulated object act as a black box.
4. Inheritance
Hierarchical relationship between super class and sub class
is called as inheritance. Every sub class has all the properties of its super
class and its unique properties. Inheritance supports the hierarchical
classification.
5. Polymorphism
Polymorphism
means the ability to take more than one form. An operation may exhibit different
behaviors which depend on the data types and methods used in the operation.
6. Message Communication
An object can communicate with one or more
objects by sending and receiving information, such as people do. There are
sending objects and receiving objects. This communication helps to bind all the
objects as a system.
Object has a life cycle. We can only communicate while it is alive. Sometimes, “message passing” helps to start objects operations.
Comments
Post a Comment