CsitLabs
  • CSIT Labs
  • 1st Semester
    • Digital Logics
      • Lab 1
      • Lab 2
      • Lab 3
      • Lab 4
      • Lab 5
      • Lab6
    • IIT
    • Physics Lab Report Formet
  • 2nd Semester
    • Algorithms used in Discrete Structure class
    • Microprocessor
      • 8085 Microprocessor
        • Arithmetic and Logical Instruction Set
        • Branching Instruction Set
        • Data Transfer and Instruction Set
        • Multiply, Divide and Memory Block Operations
        • Rotate Instruction Set
        • Subroutine, Stack and BCD Conversion](Subroutine_Stack_BCD_Conversion
      • 8086 Microprocessor
        • Basic Arithmetic
        • Practice Programs for 8086 Microprocessor
        • String Processing
    • Object Oriented Programming using C++
      • File Access Pointers
      • Standard Exceptions in C++
    • Statistics-I
  • 3rd Semester
    • Computer Architecture
      • Practical labs
    • Computer Graphics
      • Practial
      • Simulation of Two Dimensional Transformation
      • Scan Conversion Algorithm
    • Data Structures and Algorithms
      • Array methods (Introduction)
      • Stack
      • Queue
      • Recursion
      • Linked List
      • Sorting Algorithms
      • Searching and Hashing Algorithms
      • Trees and Graphs
      • Lab practice
    • Numerical Method Labs
      • Lab practice
    • Statistics-II Labs
      • Confidence interval of mean assuming normal distribution
      • One Sample T test
      • Two Sample T test
      • Regression Analysis
      • Two Sample T test
      • Design_of_Experiment
        • CRD (Completely Randomized Design)
        • RBD (Randomized Block Design)
        • RBD (Randomized Block Design)
      • Non-parametric_test
        • Binomial Test
        • Cochran Q test
        • Kolmogorov-Smirnov one sample test
        • Run test
        • Friedman-F_test
          • Friedman F test
          • Friedman F test
        • Kruskal-Wallis-H_test
          • Kruskal Wallis H test
          • Kruskal Wallis H test
        • Mann-Whitney-U_test
          • Mann Whitney U test
          • Mann Whitney U test
        • Median_test
          • Median Test
          • Median Test
        • Wilcoxon-Matched-pair_signed_rank_test
          • Wilcoxon Matched pair signed rank test
          • Wilcoxon Matched pair signed rank test
  • 4th Semester
    • Artificial Intelligence
    • Computer Networks
      • Networking commands in CMD
    • DBMS Lab
    • Operating System
      • Linux Commands
    • Theory of Computation
      • Lab 1 (DFA)
      • Lab 2 (NFA)
  • 5th Semester
    • Cryptography
    • Design and Analysis of algorithms
    • Multimedia
      • Animation Creation with Blender
      • FL Studio - Simple Effect Creation
      • Macromedia FreeHand - Logo Creation
      • Audio Mixing
      • Adobe Photoshop - ID Card Creation
      • Video Editing with Adobe Premiere Pro
    • Simulation & Modeling
      • Lab 1: Random Number Generation
    • System Analysis and Design
    • Web Technology
      • Lab Assignment – I (HTML)
      • Lab Assignment – II (CSS)
      • Lab Assignment – III (JavaScript and XML)
      • Lab Assignment – IV (PHP)
      • Web Technology
        • php
          • Database connection using PHP and MySQL
          • Login form
          • Login form
  • 6th Semester
    • Compiler Design and Construction
    • NET Centric Computing
      • Class Codes
        • Authentication and Authorization in ASP.NET
        • C# Basics
      • Lab Codes
        • Practical 1
        • Practical 2
          • Number Operations Web App
          • User Registration Form
          • User Registration Console App
        • Practical 3
          • Authentication and Authorization (Claims, Roles and Policies)
          • Client side state management in ASP.NET
          • Entity Framework Core
          • Form Validation
            • React form validation
          • HTML Tag Helpers
          • MVC demonstration
          • Razor Syntax
          • Server Side State Management in ASP.NET
      • Self Projects
        • Do while programs
        • Role playing game battle challenge
        • Project overview
        • Authentication
          • wwwroot
            • lib
              • jquery-validation
                • The MIT License (MIT)
  • 7th Semester
    • Advanced Java Programming
      • Class Codes
        • Unit1-6&8
          • javafx-sdk-21.0.1
            • legal
              • javafx.graphics
                • Independent JPEG Group (IJG) JPEG v9e
                • Mesa 3-D Graphics Library v21.0.3
              • javafx.media
                • Microsoft DirectShow Samples v156905
                • GNU Glib v2.72.0
                • GStreamer v1.20.1
                • LibFFI v3.4.4
              • javafx.web
                • IBM International Components for Unicode (ICU4C) v73.1
                • xmlsoft.org: libxml2 v2.10.4
                • xmlsoft.org: libxslt v1.1.35
                • WebKit Open Source Project: WebKit v616.1
          • src
            • main
              • java
                • Unit 1: Programming in Java
                  • 2. Concepts and Topics
                • Unit 2: User Interface Components with Swing
                • Unit 3: Event Handling
                • Unit 4: Database Connectivity
                • Unit 5: Network Programming
                • Unit 6: GUI with JavaFX
        • Unit7
          • src
            • main
              • webapp
                • index
      • Lab Codes
        • Lab
          • src
            • main
              • java
                • Practical 1
                • Practical 2
                • Practical 3
                • Practical 4
                • Practical5
    • Data warehouse and Data mining
  • docs
    • Contributor Covenant Code of Conduct
Powered by GitBook
On this page
  • Table of Contents
  • Introduction
  • Characteristics/Features of OOP
  • Objects
  • Classes
  • Encapsulation
  • Abstraction
  • Inheritance
  • Polymorphism
  • Benefits of OOP

Was this helpful?

  1. 2nd Semester

Object Oriented Programming using C++

PreviousString ProcessingNextFile Access Pointers

Last updated 8 months ago

Was this helpful?

Table of Contents

Introduction

Object-oriented programming (OOP) was developed to overcome the limitations of the procedure-oriented programming is an improved technique for developing the programs.

In case of OOP, the data is treated as the most critical element and the primary focus is on the data and not on the procedures. In this technique, the data is grouped together with the functions that operate on it.

  • A problem is divided into entities known as objects.

  • Each object maintains its own copy of data and functions.

The data cannot be accessed directly by the other objects of the program. It can only be accessed through a proper interface such as functions.

Examples of OOP languages include Simula, C++, Python, Java etc.

Characteristics/Features of OOP

Objects

  • In object-oriented programming, a problem is divided into certain basic entities called objects. The objects can be used to represent real life objects such as people, car, and so on.

  • In this type of programming, all communication is carried out between the objects. When a program is executed, the objects interact with each other by sending messages.

  • The objects contain the data and the functions that can be used to manipulate the data. Each object maintains its own copy of the data and methods, which can communicate with each other through a proper channel or interface.

Classes

  • A class is a user-defined data type which is used to group the data and the functions together.

  • The objects are the instances of a class.

  • A class can also contain important members such as a constructor to create objects.

  • The objects that belong to same class must have certain properties in common. • For example, a table and a chair are the objects of the furniture class. Both the objects have certain properties in common. For example, both are made of wood and so on.

Encapsulation

  • Encapsulation is a mechanism used for wrapping up the data along with the functions that can operate on the data directly.

  • This mechanism is used to keep the data safe from outside interferences.

  • It hides the internal data and only provides the external interface (functions) through which it can be accessed.

  • Encapsulation also provides the concept of data hiding or information hiding so that it cannot be accessed directly.

Abstraction

  • Data abstraction is one of the most essential and important feature of object oriented programming in C++.

  • Abstraction means displaying only essential information(result) and hiding the details(pow() in math.h or add() defined by user).

  • Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation.

  • Consider a real life example of a man driving a car. The man only knows that pressing the accelerators will increase the speed of car or applying brakes will stop the car but he does not know about how on pressing accelerator the speed is actually increasing, he does not know about the inner mechanism of the car or the implementation of accelerator, brakes etc in the car. This is what abstraction is.

Inheritance

  • Different kinds of objects often have certain amount of properties in common with each other.

  • Inheritance is the process by which one object can acquire the properties of another object. This is called the reusability of code.

  • In inheritance, whenever a new object is created, it can only define those properties that makes it unique from the other objects.

  • Inheritance supports the concept of the hierarchical classifications.

  • For example, the fruit ‘Apple’ is a part of the class ‘Fruits’, which is again a part of the class ‘Food’.

  • The two classes Fruits and Vegetables, apart from inheriting certain properties from the class Food, add some properties of their own.

  • The classes Apple and Mango inherit the properties of the Fruits class while the classes Cabbage and Carrot inherit the properties of the Vegetables class.

Polymorphism

  • Polymorphism is another feature of object-oriented programming.

  • Polymorphism is a Greek term that consists of two words, poly and morph. Poly means many and morph means forms. So, polymorphism means ‘one name many forms’.

  • In polymorphism, the internal structure (functioning) of the operation is different but the external interface (name) is the same. When a single function name is used to perform different operations, it is known as function overloading.

Benefits of OOP

  • By using inheritance, we can eliminate redundant code and extend the use of existing classes.

  • We can build the programs from standard working modules that communicate with one another, rather than having to start writing the code from scratch which leads to saving of development time and higher productivity.

  • The new technology promises greater programmer productivity, better quality of software and lesser maintenance cost.

  • OOP systems can be easily upgraded from small to large systems.

  • It is possible that multiple instances of objects co-exist without any interference.

  • It is very easy to partition the work in a project based on objects.

  • The principle of data hiding helps the programmer to build secure programs which cannot be invaded by the code in other parts of the program.

Basics of C++ Programming
Classes and Objects
Operator Overloading
Inheritance
Virtual function, Polymorphism
Function Templates and Exception
File Handling and Streams
Overview of OOP
Objects
Classes
Encapsulation
Abstraction
Inheritance
Polymorphism