Vaisakhi Offer- Use Code VAISAKHI24

Register Now

Object Oriented Programming (OOP) concepts - 1

Published on Thursday, November 03, 2016
Hi Folks, 
Hope your preparations for specialist officer's exam are going well. Object Oriented Programming is one valiantly used concept in software systems today. We'll start with a series of articles on OOP and cover all important aspects in coming days. Post completion of the topic, I'll share MCQs as well for practice. Please feel free to raise your doubts & start discussions in the comments section!

What are objects & classes?

Object - is a section of source code that contains data (attributes) & provides services (via methods).
Classes - describe objects. Objects are run time instances of classes. Each instance (object) of a class has a unique identity and its own set of values for its attributes.

Key Features of OOP

  • Instantiation 
    • process of creating an object is called instantiation. 
    • you can create multiple instances of a class.
  • Abstraction
    • It is the ability to reflect real world processes which are modeled in classes and mapped in objects.
  • Encapsulation
    • In this, the implementation details are hidden behind interfaces.
  • Inheritance
    • It is the process by which one object acquires the properties of another object.
    • It enhances the REUSABILITY feature.
  • Polymorphism
    • It means that same thing can exist in two forms. 
    • Each sub class can have a different implementation of the method declared in parent class i.e we assign a different behavior or value in a sub class. 
  • Overloading
    • When an existing operator or function is made to operate on a new data type, we call it overloading. 
  • Exception handling
    • To handle unresolved exception or errors produced at run time, some events are raised to catch those exceptions and continue execution of program in a normal way. 

    How to access CLASSES?

    We use 3 access specifiers PUBLIC, PRIVATE & PROTECTED for accessing the data and methods inside a class. 

    1. PUBLIC 

    All the class members declared under PUBLIC will be available to everyone (other classes too). Key member functions must not be declared PUBLIC.

    2. PRIVATE

    No one outside the class can access the members declared PRIVATE. In case of an unauthorized access, systems give a compile time error. 


    Like PRIVATE, class members are inaccessible outside the class but can be accessed by sub class of the parent class. 

    Types of Inheritance 

    Deriving a class from base class can be done in 3 ways based on how base classes have been defined.
    • Public Inheritance - When base class is public, public members of base class become public members of derived class & protected members (base class) become protected ones of derived class. Private members (base class) are only accessed through calls to Public & Protected members from the derived class, never directly. 
    • Private Inheritance - When base class is private, public & protected members (base class) become private members of derived class. 
    • Protected Inheritance - When base class is protected, public & protected members (base class) become protected members of derived class. 

    Some facts about C++

    • Developed by Bjarne Stroutsrup in early 1980s in USA.
    • The name C++ came from C increment operator ++ which means it is an augmented version of C.
    • It got its Object oriented features from SIMULA67 programming language.
    • You can write a program without semicolons.
    • Concepts of reference variable and operator overloading have been taken from ALGOL68 language.
    Read Part 2 of this article
    ebook store

    About us

    ramandeep singh

    Ramandeep Singh is a seasoned educator and banking exam expert at BankExamsToday. With a passion for simplifying complex concepts, he has been instrumental in helping numerous aspirants achieve their banking career goals. His expertise and dedication make him a trusted guide in the journey to banking success.

    • Follow me:
    Close Menu
    Close Menu