Course Title: Object-Oriented Programming
Course No: BIT153
Nature of the Course: Theory + Lab
Semester: II
Course Description
This course is designed to introduce students to the fundamental principles of object-oriented programming (OOP) using C++. It emphasizes the development of programs using OOP techniques, covering core topics such as classes, objects, operator overloading, inheritance, polymorphism, file handling, exception management, and templates.
Course Objectives
The primary goal of this course is to help students:
- Understand the basics of OOP and its advantages over procedural programming.
- Learn key concepts like abstraction, encapsulation, inheritance, and polymorphism.
- Apply C++ programming constructs to solve practical problems using OOP.
- Gain hands-on experience in designing, implementing, and debugging OOP programs.
Detailed Syllabus
Unit 1: Introduction to Object-Oriented Programming (3 Hrs.)
1. Programming Paradigms:
- Overview of structured programming and object-oriented programming.
2. OOP Characteristics:
- Objects, Classes, Data Abstraction, Encapsulation, Inheritance, Polymorphism, Dynamic Binding, and Message Passing.
Unit 2: Basics of C++ Programming (5 Hrs.)
1. C++ Fundamentals:
- Program structure, character set, tokens, data types, type conversion.
- Preprocessor directives, namespaces, and input/output streams (`cin`, `cout`).
- Cascading I/O operators and manipulators (`endl`, `setw`, `setprecision`).
- Dynamic memory allocation using `new` and `delete`.
2. Control Statements: Review of conditional and looping constructs.
3. Functions:
- Function overloading, inline functions, default arguments.
- Pass by reference, return by reference, and scope/storage classes.
4. Pointers:
- Declaration, initialization, and pointer arithmetic.
- Using pointers with arrays and functions.
Unit 3: Classes and Objects (10 Hrs.)
1. Introduction:
- Structures vs. Classes, creating classes, accessing class members.
- Memory allocation for objects and member functions.
2. Constructors and Destructors:
- Types of constructors (default, parameterized, copy).
- The default copy constructor and its customization.
3. Object Operations:
- Objects as function arguments and return values.
- Static members (data and functions).
4. Advanced Features:
- Friend functions, friend classes, `this` pointer, and copy initialization.
Unit 4: Operator Overloading (7 Hrs.)
1. Basics:
- Principles and restrictions of operator overloading.
- Operator functions as class members.
2. Unary Operator Overloading:
- Overloading pre-increment, post-increment, and negation operators.
3. Binary Operator Overloading:
- Overloading arithmetic and comparison operators.
- String concatenation using operator overloading.
4. Data Conversion:
- Conversions between basic types and user-defined types.
Unit 5: Inheritance (7 Hrs.)
1. Concepts:
- Base and derived classes, access specifiers (private, protected, public).
2. Types of Inheritance:
- Single, multiple, hierarchical, multilevel, and hybrid inheritance.
- Public, protected, and private inheritance.
3. Constructors and Destructors:
- Order of execution in inheritance hierarchies.
4. Aggregation and Ambiguity:
- Aggregation vs. inheritance, ambiguity resolution in multiple inheritance, and virtual base classes.
Unit 6: Virtual Functions and Polymorphism (3 Hrs.)
1. Polymorphism:
- Static vs. dynamic polymorphism.
2. Virtual Functions:
- Concepts, implementation, pure virtual functions, abstract classes.
- Roles of polymorphism in application design.
Unit 7: Templates and Exception Handling (4 Hrs.)
1. Templates:
- Function templates and class templates.
- Templates with multiple arguments and inheritance.
2. Exception Handling:
- Mechanism using `try`, `catch`, and `throw`.
- Handling multiple exceptions and catching all exceptions.
Unit 8: File Handling in C++ (6 Hrs.)
1. File Operations:
- File pointers (read/write), text file operations, and binary file operations.
- Detecting end-of-file conditions.
2. Object Persistence:
- Reading and writing objects, random file access.
Textbooks
1. Robert Lafore, Object-Oriented Programming in C++, Fourth Edition, SAMS Publications.
Reference Books
1. Deitel & Deitel, C++ How to Program, Third Edition, Pearson.
2. Joyce Farrell, Object-Oriented Programming Using C++, Fourth Edition, Cengage Learning.
3. Herbert Schildt, C++: The Complete Reference, Fourth Edition, Tata McGraw Hill.
4. E. Balagurusamy, Object-Oriented Programming with C++, Seventh Edition, McGraw Hill India.
5. A. S. Saud, C++ Programming with Object-Oriented Approach, Second Edition, KEC Publications.
This course provides a strong foundation in C++ programming and OOP concepts, preparing students for advanced programming challenges and software development.