Close Menu
Durofy – Business, Technology, Entertainment and Lifestyle Magazine
  • Business
  • Technology
  • Engineering
  • Startups
  • Coding
  • Entertainment
  • Lifestyle
  • Real Estate
  • Finance
  • Tools
Facebook X (Twitter) Instagram Pinterest
Trending
  • The Viral ’80s AI Photo Trend: Turn Your Selfie Into a Retro Magazine Cover
  • How a Portable Dishwasher Changed My Small Kitchen
  • Why Nautica Voyage Stuck With Me
  • Comfortable Black Dress Oxfords That Actually Work
  • The Hospital Paperwork That Can Shape Your Injury Case
  • The $20 Cardigan That Fixed My Fall Wardrobe
  • How One $4 Brow Pencil Fixed My Sparse Brows
  • Your Devices Testify Before You Do: What Smart Home and Wearable Data Reveal After a Car Crash
Facebook X (Twitter) Instagram
Durofy – Business, Technology, Entertainment and Lifestyle MagazineDurofy – Business, Technology, Entertainment and Lifestyle Magazine
Subscribe
Sunday, September 13
  • Business
  • Technology
  • Engineering
  • Startups
  • Coding
  • Entertainment
  • Lifestyle
  • Real Estate
  • Finance
  • Tools
Durofy – Business, Technology, Entertainment and Lifestyle Magazine

The Basics Of Object Oriented Programming

Vincent CruzBy Vincent CruzAugust 11, 2009Updated:March 20, 2024 Coding 28 Comments5 Mins Read

As I pointed out in my previous post, we use classes in Object Oriented Programming(OOP) which are a blueprint of objects that share common properties. This use of classes & more precisely, of objects makes the process of programming easy & efficient.

That was exactly the reason why the Object Oriented Programming Paradigm was introduced. Now, there are certain fundamental features that you would find in every object oriented programming language.

Lets now take a look at each of them individually,
Lets take up CLASSES first. They consists of entities called objects-or they are blueprints of objects.

For example, a car would be a class & a van would be an object that belongs to the class called cars. Now, once we know the behavior of this object, we can use it anywhere we need in the program without having to define the behavior/properties again & again, which is the basic aim of OOP.

The objects here act as building blocks of the program. Though the objects can differ in terms of specific attributes(like a van could be red or blue), the classes would only depict the common behavior of all objects(like each car would have 4 wheels, turn left, right & so on…)

Now, the basic features of OOP…

A) Polymorphism – It simply implies “something having various forms”.
In the OOP world, this is evident with variables & functions.(and hence, with objects as well)

For instance, A variable called MEMBERID could take a name or a number & the program would recognize & accept both.

Another example is the “+” sign which can denote the mathematical operation, or strings or lists.

B) Inheritance – It is simply forming new classes(derived classes) from previously existing ones(base classes). In the process, the derived classes inherit certain properties of the base classes.

The concept is similar to how children inherit certain features from their parents, hence, the base classes are also sometimes refereed to as ancestor classes.

In terms of relationships, we call the relation between the base & derived class the as-is relationship. Consider the base class “car” & the derived class “bmw”. Then we can say “bmw” is-a “car” which is generalized to “derived class” is-a “base class”.

Encapsulation, Data Abstraction & Information hiding are very similar concepts & people often confuse them to be the same.

In one single statement, Abstraction is a technique that lets us know what information should be visible, and what information should be hidden. Encapsulation is the technique to display the information in a way as to hide what should be hidden, and show what’s needed.
Then, Information Hiding is the process of hiding all the inessential details of an object.


More on OOP : Concepts with Examples (By Mamta Paul)

OOP is abbreviated as object oriented programming. Before C++ was introduced, programming languages were procedure oriented languages. But with the advancement of new features, languages are now object-focused. First of all, what this object is. An object represents an entity from real world. Eg: We can create employee, student, book as objects. Classes are group of objects classified on the basis of their common attributes (characteristics). Thirdly, methods are functions that determine behavior of objects. Eg: for a class book, methods can be publish(), edit() etc.

Now, let us try to understand what these new features of OOPs are:

(1) Encapsulation: It means encapsulating or protecting from the outer world. It is basically binding data members and functions together. Eg:

Private Class book

{

                        Int edition();

                        Char Publish():

                        Int x;

                        Char y;

}

Class page

{

                        Int pageno;

}

Here edition() and publish() are the functions which are binded with data members x and y under a single class book. By declaring the book class private, it is encapsulated from the outer class – page.

basics-of-object-oriented-programming-2

(2) Abstraction: It generally means some data is visible and the rest is not. In OOPs, classes can be abstracted. That is, we can make essentials features of a class to be accessible and the rest inaccessible to another class. OOPs give the advantage of protecting the data of a class from unauthorized access by another class. Data of a class can be protected by using the words: private, protected etc.

Eg:  class book

            {

                        Public: Int edition();

                                     Char Publish():

                        Private: Int x;

                                      Char y;

            }

            class page: public book

            {

                        Int pageno;

            }

Data members; x and y of book class can not be viewed by page class since these are protected by the word private.

basics-of-object-oriented-programming-2

(3) Inheritance: If we talk in biological terms, it means features inherited by the child from his parents. In the same way, derived class derives features from its parent class.

Eg: Public class book

            {

                        Public Char author, date;

            }

                 Class page: public book;

            {

                        Int pageno;

            }

Page class which is a child class derives the features like author, date automatically from book class which is its parent class.

(4) Reusability: With the addition of OOPs concepts, it has become possible to reuse the old code and to make a new code by adding new features into it. We can make changes on the existing coding rather than writing the whole code again. Actually, functions in OOP are reusable; once created, they can be used again and again in different applications.

(5) Polymorphism: ‘Poly’ means many and ‘morphism’ means many forms, so the word means existence in many forms. In OOP, we can use one object in different forms.

Eg: int sum(int a, int b);

       Int sum(int a, int b, int c);

       Float sum(int x, int y);

Thus the number and types of parameters change but sum function remains same. So, function like sum() can take different forms. Thus, OOP gives the benefit of polymorphism.

RELATED Understanding Inheritance in OOP

Vincent Cruz
Vincent Cruz

Founder & Editor at Durofy

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous Article[C++ Tutorial 2] Multi-Paradigm Programming
Next Article Signal Operations – Time Shifting, Scaling & Inversion

Keep Reading

Discovering CodeMonkey: A Family Coding Adventure

How I Finally Broke Through My Coding Plateau with Educative.io

The Future of Work: How AI and Large Language Models Are Reshaping Jobs

5 Web Design Mistakes You’re Making (That Are Turning Off Customers)

Educative.io: The Best Interactive Courses for Developers & Programmers in 2024

CodeMonkey: The Best Platform for Game-Based Programming for Kids

View 28 Comments

28 Comments

  1. A.S.Tatuskar on October 23, 2013 2:46 pm

    Very Very Nice Explaination is given.

    Reply
    • Rishabh Dev on October 23, 2013 2:50 pm

      Hi Anjali, Thanks for the comment! We would love to see you come back and read more of our related articles @ Durofy!

  2. Amaranath reddy on June 19, 2013 2:29 pm

    Interesting material, well explained !!!

    Reply
    • Rishabh Dev on October 23, 2013 2:50 pm

      Hi Amaranath, Thanks! We would love to see you come back and read more of our related articles @ Durofy!

  3. Dhivya on May 29, 2013 10:28 pm

    awesome explanation of OOPs, Thanks ya…

    Reply
    • Rishabh Dev on October 23, 2013 2:51 pm

      Always welcome Dhivya! Do come back for more concepts and articles!

  4. aaravid on May 6, 2013 11:00 am

    nice and good to learn all

    Reply
    • Rishabh Dev on October 23, 2013 2:51 pm

      Thanks for the comment! Do read our other interesting articles!

  5. Raj mohan on December 2, 2012 7:57 pm

    Sir place tell in simplest way abt oop

    Reply
    • Rishabh Dev on October 23, 2013 2:52 pm

      Hi Raj! This tutorial provides a good and easy explanation of OOP. Let me know if you have any doubts!

  6. naseema on July 5, 2012 3:08 pm

    thank you

    Reply
    • Rishabh Dev on October 23, 2013 2:52 pm

      Thank you for reading Naseema!

  7. pooja on June 30, 2012 2:43 am

    sir plz tell more about Polymorphism,Encapsulation,Information Hiding.

    Reply
    • Rishabh Dev on October 23, 2013 2:54 pm

      Hi Pooja, Thanks for your comment! We constantly add new material and concepts within programming. Do visit the section at http://www.durofy.com/category/computing/ for more articles on programming / coding and concepts!

  8. pooja on June 30, 2012 2:39 am

    well explained ..thanks..

    Reply
    • Rishabh Dev on October 23, 2013 2:54 pm

      Thanks for reading Pooja :)

  9. sukanya on June 23, 2012 6:38 am

    hi sir plz more tell about

    Polymorphism Encapsulation i

    Reply
    • Rishabh Dev on October 23, 2013 2:55 pm

      Hi Sukanya, Thanks for your comment! We constantly add new material and concepts within programming. Do visit the section at http://www.durofy.com/category/computing/ for more articles on programming / coding and concepts! As per the requests, I will post about the individual concepts on the same page! Do come back for the same :)

  10. john on March 17, 2012 6:15 am

    This is a very good site.. very well designed.

    Reply
    • Rishabh Dev on October 23, 2013 2:56 pm

      Thanks John! :)

  11. Faizan on February 9, 2012 1:43 pm

    Yeah,this explains OOP clearly !

    Reply
  12. Varun on August 8, 2011 7:55 am

    Hi, again well explained..and thank you so much fyi….all d best.

    Reply
    • Rishabh Dev on August 8, 2011 12:38 pm

      Thank You, Varun :)

  13. Kartlos Tchavelachvili on September 12, 2010 10:34 am

    OOP Wel explained, Thanks!

    Reply
  14. MFA on February 5, 2010 3:50 am

    more on Information Hiding & Encapsulation

    Encapsulation is the process of information hiding and encapsulation in OOP is due to interaction of user(… another object). There is only way to get method (operation to be performed on object) execute is the messaging. user doesn’t know about internal myths of object (or blueprint : Class). this property makes encapsulation possible.

    Several authors and OO guru also argue about attributes encapsulation. because in functional programming languages you need to manage data separately in the form of variables (includes local and global) but in OOP each contains its associated data and operations in itself(in the form of attributes and methods generally speaking class members).

    Reply
  15. Pingback: 10 Major Differences Between C And C++ at Detrix

  16. Pingback: 10 Major Differences Between C And C++ » Durofy

  17. chhavi on August 12, 2009 9:03 am

    thanx now i came to know something about the topic…

    Reply
Leave A Reply Cancel Reply

💰 Hiring Work From Home Job

Complete Online Surveys & Data collection

Flexible part-time work from anywhere. Get paid via PayPal or gift cards for sharing your opinions. No experience needed!

Start Earning Now →

Legitimate opportunities • Work on your own schedule

Recent Posts
  • The Viral ’80s AI Photo Trend: Turn Your Selfie Into a Retro Magazine Cover
  • How a Portable Dishwasher Changed My Small Kitchen
  • Why Nautica Voyage Stuck With Me
  • Comfortable Black Dress Oxfords That Actually Work
  • The Hospital Paperwork That Can Shape Your Injury Case
  • The $20 Cardigan That Fixed My Fall Wardrobe
  • How One $4 Brow Pencil Fixed My Sparse Brows
  • Your Devices Testify Before You Do: What Smart Home and Wearable Data Reveal After a Car Crash
  • The Renewal Offer Got Weird: Four Lease Deal Formats Landlords Are Sending in 2026
  • How One Cream Changed My Morning Routine
  • From Stiff Dress Pants to All-Day Comfort: My Switch to Libin Golf Pants
  • How COSRX Snail Mucin Fixed My Skin Barrier
  • These Soft Cork Footbed Clogs Actually Deliver All-Day Comfort
  • How This Cookware Set Changed My Kitchen Routine
  • How a Simple Green Tree of Life Tapestry Transformed My Space

ABOUT DUROFY

Durofy is a business, technology, science, lifestyle and entertainment digital media platform and news website founded in 2009.

Contact Durofy

For business or advertising, contact us at durofy@live.com.

Social

Like us on Facebook

Facebook X (Twitter) Instagram Pinterest
© 2026 ThemeSphere. Designed by ThemeSphere.

Type above and press Enter to search. Press Esc to cancel.