DI05011021 · Semester 5 · 5G scheme
Object Oriented Programming with C++
Notes and solutions following the Gujarat Technological University (GTU) syllabus for DI05011021. Independent material — not issued by the university.
Materials
Complete Book
The whole syllabus, unit by unit, written for the exam.
Complete Book
215 pages
Premium Preview · 15 pages
Syllabus units
Unit 1: Principles of OOP and Basics of C++
- 1.1 Overview of OOP: Procedure-oriented vs. Object-oriented programming; Basic concepts: Objects, Classes, Data Abstraction, Encapsulation, Inheritance, Polymorphism, Dynamic Binding, Message Passing.
- 1.2 Structure of C++ Program: Tokens, Keywords, Identifiers, Variables, Data Types (int, float, char, bool, etc.), Reference Variables.
- 1.3 Operators: Arithmetic, Relational, Logical, Bitwise, Assignment, Increment/Decrement; Operator Precedence and Associativity.
- 1.4 Input/Output: cin, cout, manipulators; Namespaces (using namespace std;).
Unit 2: Classes and Objects
- 2.1 Specifying Class: Defining Member Functions (Inline and Outside); Nesting of Member Functions; Private, Public, Protected Members.
- 2.2 Arrays within a Class; Static Data Members and Member Functions; Arrays of Objects; Objects as Function Arguments.
- 2.3 Constructors: Default, Parameterized, Copy Constructors; Multiple Constructors in a Class.
- 2.4 Destructors: Definition and Use.
Unit 3: Inheritance and Polymorphism
- 3.1 Defining Derived Classes: Forms of Inheritance (Single, Multiple, Multilevel, Hierarchical, Hybrid); Visibility Modes (Private, Public, Protected).
- 3.2 Functions in Derived Classes: Overriding Base Class Functions; Abstract Classes; Virtual Functions.
- 3.3 Polymorphism: Compile-time (Function Overloading, Operator Overloading basics) and Run-time Polymorphism.
- 3.4 Constructors and Destructors in Derived Classes.
Unit 4: Advanced Class Features
- 4.1 Operator Overloading: Overloading Unary and Binary Operators using Member and Friend Functions; Rules and Limitations.
- 4.2 Friend Functions and Classes: Declaration and Use.
- 4.3 Pointers to Objects: this Pointer; Pointers to Derived Classes.
- 4.4 Function Templates and Class Templates: Basics and Syntax.
Unit 5: File Handling and Exception Handling
- 5.1 File Streams: Classes (fstream, ifstream, ofstream); Opening, Closing, Reading & Writing Files.
- 5.2 Binary File Operations: Update Records; Error Handling in Files.
- 5.3 Exception Handling: try, throw, catch; Multiple Throws and Catches.
- 5.4 Standard Template Library (STL) Basics: Vectors and Basic Algorithms (sort, find).
About this course
Object-Oriented Programming (OOP) using C++ builds on procedural programming by introducing concepts like encapsulation, inheritance, and polymorphism, which promote modular, reusable, and maintainable code. C++ is a widely used language in industry for developing software applications, system programming, embedded systems, and graphical user interfaces. This course equips diploma engineering students with OOP principles to solve real-world engineering problems efficiently, fostering skills in software design and development. It enhances logical thinking, code reusability, and prepares students for advanced topics in electronics and communication engineering, such as simulation tools and embedded software.