BT-205 Basic Computer Engineering

Unit 3: Object Oriented Programming & Data Structures

Complete RGPV exam-oriented page covering Object and Classes, Scope Resolution Operator, Constructors and Destructors, Friend Functions, Inheritance, Polymorphism, Function Overloading, Operator Overloading, Types of Inheritance, Virtual Functions and Introduction to Data Structures.

Read Notes Important Questions PYQ Analysis

Unit 3 Syllabus

Basic Computer Engineering Unit 3 important topics

Object & Classes

  • Object in C++
  • Class in C++
  • Data members
  • Member functions
  • Access specifiers

C++ Special Concepts

  • Scope Resolution Operator
  • Constructors
  • Destructors
  • Friend Functions
  • Static members

Inheritance & Polymorphism

  • Inheritance
  • Types of Inheritance
  • Polymorphism
  • Function Overloading
  • Operator Overloading

Virtual Functions & DS

  • Virtual functions
  • Runtime polymorphism
  • Introduction to Data Structures
  • Linear data structures
  • Non-linear data structures

Short Exam Notes

Easy revision notes for RGPV exam

Object

Object is a real-world entity that has data and behavior. Example: Student is an object having name, roll number and marks.

Class

Class is a blueprint or template for creating objects. It contains data members and member functions.

Scope Resolution Operator

Scope Resolution Operator is written as :: in C++. It is used to define member functions outside the class and access global variables.

Constructor

Constructor is a special member function which is automatically called when object is created. It has the same name as class and no return type.

Destructor

Destructor is used to destroy objects and release memory. It has same name as class but starts with tilde symbol ~.

Friend Function

Friend function is not a member of class but can access private and protected members of class. It is declared using friend keyword.

Inheritance

Inheritance is an OOP concept where one class acquires properties of another class. It improves code reusability.

Polymorphism

Polymorphism means one name, many forms. It allows same function or operator to behave differently in different situations.

Function Overloading

Function overloading means creating multiple functions with same name but different arguments. It is an example of compile-time polymorphism.

Operator Overloading

Operator overloading means giving special meaning to operators for user-defined data types. Example: using + operator to add two objects.

Virtual Function

Virtual function is declared using virtual keyword. It supports runtime polymorphism and function overriding.

Data Structures

Data Structure is a way of organizing and storing data efficiently. Examples are array, stack, queue, linked list, tree and graph.

C++ Class and Object Example

Very important program for exams

#include <iostream>
using namespace std;

class Student
{
    int roll;
    string name;

public:
    void getData()
    {
        cout << "Enter roll and name: ";
        cin >> roll >> name;
    }

    void showData()
    {
        cout << "Roll: " << roll << endl;
        cout << "Name: " << name << endl;
    }
};

int main()
{
    Student s1;
    s1.getData();
    s1.showData();
    return 0;
}

Constructor and Destructor Example

Commonly asked C++ program

#include <iostream>
using namespace std;

class Demo
{
public:
    Demo()
    {
        cout << "Constructor called" << endl;
    }

    ~Demo()
    {
        cout << "Destructor called" << endl;
    }
};

int main()
{
    Demo d;
    return 0;
}

Quick Revision Points

Must remember points for exam

Class: Blueprint of objects
Object: Instance of a class
:: Operator: Scope Resolution Operator
Constructor: Automatically called when object is created
Destructor: Automatically called when object is destroyed
Inheritance: Acquiring properties of one class into another class
Polymorphism: One name, many forms
Virtual Function: Supports runtime polymorphism
Data Structure: Organized way to store and manage data

Most Important Questions

High chance RGPV exam questions

14 Marks Questions

  • Explain class and object in C++ with suitable example.
  • Explain scope resolution operator with example.
  • Explain constructors and destructors in C++ with examples.
  • Explain friend function with syntax and example.
  • Explain inheritance and its types with examples.
  • Explain polymorphism and its types in C++.
  • Explain function overloading and operator overloading with examples.
  • Explain virtual functions and runtime polymorphism.
  • Explain introduction to data structures and their types.
  • Differentiate compile-time polymorphism and runtime polymorphism.

7 Marks Questions

  • Define class and object.
  • Write syntax of class in C++.
  • Explain access specifiers.
  • What is scope resolution operator?
  • What is constructor?
  • What is destructor?
  • What is friend function?
  • Explain single and multiple inheritance.
  • Explain function overloading.
  • Explain operator overloading.
  • What is virtual function?
  • Define data structure and its types.

Important Differences

  • Class vs Object
  • Constructor vs Destructor
  • Function Overloading vs Function Overriding
  • Compile-time Polymorphism vs Runtime Polymorphism
  • Single Inheritance vs Multiple Inheritance
  • Linear Data Structure vs Non-linear Data Structure

PYQ Analysis Table

Repeated and high-priority RGPV exam topics

Topic Repeated Questions Frequency Priority
Class and Object Definition, syntax, example program and difference Very High ★★★★★
Constructor & Destructor Types, features, syntax and program Very High ★★★★★
Inheritance Inheritance concept and types with diagram Very High ★★★★★
Polymorphism Compile-time and runtime polymorphism Very High ★★★★★
Function Overloading Same function name with different parameters High ★★★★
Operator Overloading Operator keyword, syntax and example High ★★★★
Virtual Function Runtime polymorphism and base class pointer High ★★★★
Friend Function Access private members using friend keyword Medium ★★★
Data Structures Definition, need and types of data structures High ★★★★

Read Documents

Keep these PDFs in the same folder as this HTML file

Download Notes PDF

FAQs

Common student doubts

Which topic is most important in Computer Unit 3?

Class and object, constructors, destructors, inheritance, polymorphism, overloading and virtual functions are most important.

Which C++ programs should I prepare?

Class and object program, constructor-destructor program, inheritance program, function overloading and operator overloading programs should be prepared.

What is the most important difference in Unit 3?

Class vs Object, Constructor vs Destructor, Function Overloading vs Overriding and Compile-time vs Runtime Polymorphism are very important.

Is Data Structure important in Unit 3?

Yes, Introduction to Data Structures is important. Prepare definition, need, types, linear and non-linear data structures.

Related Units

Unit 1 Unit 2 Unit 4 Unit 5