OOP in C++
OOP in C++
Course Description:
This course introduces students to the principles of object-oriented programming (OOP) using
C++. It covers OOP concepts such as classes, objects, inheritance, polymorphism, encapsulation,
and abstraction, along with advanced features like operator overloading, file handling, templates,
and exception handling.
Course Objectives:
By the end of the course, students will be able to:
• Understand the fundamentals of object-oriented programming.
• Use C++ syntax and semantics to write efficient object-oriented programs.
• Implement key OOP concepts like classes, inheritance, polymorphism, and abstraction.
• Apply exception handling and file operations in real-world problems.
• Develop reusable and maintainable software systems.
Course Contents:
Unit 1
Introduction to C++ and OOP [3 hrs.]
Evolution of C++ from C, Key differences between C and C++, Structure of a C++ program,
Basic I/O operations (Cin, Cout), Introduction to OOP concepts: Class, Object, Abstraction,
Encapsulation, Inheritance, Polymorphism
Unit 2
Classes and Objects [7 hrs.]
Defining classes and creating objects, Access specifiers: public, private, protected, Namespace,
scope resolution operator, member functions (inside and outside class), inline function, storage
classes: (automatic, external, static, register)., Static data members and functions, this pointer
Constructors and destructors, types of constructor (default, parameterized), Dynamic constructor,
copy constructor, constructor overloading, manipulating private data members.
Unit 3
Operator Overloading and Type Conversion [7 hrs.]
Introduction to operator overloading, overloading unary and binary operators, Friend functions,
friend class, Type conversion: Basic-to-class, Class-to-basic, Class-to-class.
Unit 4
Inheritance [7 hrs]
Base class and Derived class, Concept and types of inheritance, Constructors and destructors in
inheritance, Ambiguity and virtual base classes, Object slicing.
Unit 5
Polymorphism and Virtual Functions [7 hrs.]
Function overloading, Function overriding, Pointers to objects, Virtual functions and late
binding, Pure virtual functions and abstract classes.
Unit 6
Templates and Exception Handling [7 hrs]
Function templates and class templates,use of templates, Exception handling basics: Try, throw,
catch blocks, Multiple catch blocks and nested try, purpose of exceptional handling.
Unit 7
File Handling in C++ [7 hrs.]
File streams (ifstream, ofstream, fstream), Reading from and writing to files/console, File
modes, Binary and text file operations, command line arguments, file pointer and their
manipulator: specifying the position, specifying the objects,tellg(),seekg(),tellp(),seekp().
Laboratory Work: