The main objective of this course is to understand the basics of object oriented programming. This course covers the C++ concepts such as objects, class, operator overloading, inheritance and polymorphism, file I/O, exception handling and templates.
Course Description
The course familiarizes students with the concepts of object oriented programming using C++.
S1:Introduction to Object Oriented Programming[3]
S2:Basics of C++ programming[5]
1
C++ Program Structure, Character Set and Tokens, Data Types, Type Conversion, Preprocessor Directives, Namespace, Input/Output Streams (cin and cout object, Cascading of IO Operators) Manipulators (endl, setw, and setprecision), Dynamic Memory Allocation with new and delete, Review of Control Statements.
2
Functions: Function Overloading, Inline Functions, Default Argument, Pass by Reference, Return by Reference, Scope and Storage Class.
3
Pointers: Review of Pointer variables declaration & initialization, Operators in pointers/Pointer Arithmetic, Pointers and Arrays, Pointer and Function.
S3:Class and Objects[10]
1
Structures and Classes, Class and Object, Accessing members of class, Memory allocation for Objects, Defining Member functions of the class (inside and outside the class).
2
Initialization of class object (Constructor), Destructor, Types of Constructor (Default Constructor, Parameterized Constructor, Copy Constructor, The Default Copy Constructor).
3
Objects as Function Arguments, Returning Objects from Functions, Static members (Static data members and static member functions).
4
Friend Function and Friend Class, Copy Initialization, This Pointer.
S4:Operator Overloading[7]
1
Fundamental of operator overloading, Restriction on operator overloading (operators that cannot be overloaded), Rules for Overloading Operators. Operator functions as a class members.
2
Overloading unary Operators: Overloading Pre increment, Post-increment, and Negation Operator.
3
Overloading Binary Operators: Overloading Plus Operator, Overloading Comparison Operator, String Concatenation using operator overloading.
4
Data Conversion: Basic to User-defined/class, User-defined/class to Basic, User-defined/class to User-defined/class.
S5:Inheritance[7]
1
Introduction to inheritance, Derived Class and Base Class, Access Specifiers (private, protected, and public).
2
Types/Forms of inheritance (Single, Multiple, Hierarchical, Multilevel, Hybrid), Public, Protected and Private Inheritance.
3
Constructor and Destructor in derived classes (Order of execution of Constructors and Destructors).
4
Aggregation, Aggregation vs. Inheritance, Ambiguity (Ambiguity in Multiple and Multipath Inheritance), Virtual Base Class.
S6:Virtual Function, Polymorphism, and other C++ Features[3]
1
Concept of Static and Dynamic Polymorphism, Pointers to Base Class, Concept of Virtual functions, Implementation of Dynamic Polymorphism, Abstract class, Concrete Class, Pure Virtual Functions, Virtual Destructors, Roles of Polymorphism.
S7:Function Templates and Exception Handling[4]
1
Templates: Introduction, Function Templates, Function templates with multiple arguments, Class Templates, Templates and Inheritance, Rules for Using Templates.
2
Exception Handling: Introduction, Mechanism of Exception Handling, Try, catch and throw statements, Multiple Catch Statement, Catching All Exceptions, Uses of exception handling.
S8:File and Streams[6]
1
Stream Class Hierarchy, File pointers (Read and Write Pointer), Reading and Writing Text Files, Detecting end of file, Reading and Writing Binary Files
2
Reading and Writing Objects, Random File Access.
References
1.
Robert Lafore, Object Oriented Programming in C++, Fourth Edition, SAMS publications.
2.
Deitel and Deitel, C++ How to Program, Third Edition, Pearson Publication.
3.
Joyce Farrell, Object-oriented programming using C++, Fourth Edition, Cengage Learning.
4.
Herbert Schildt, C++ The Complete Reference, Fourth Edition, Tata McGraw Hill Publication.
5.
E. Balagurusamy, Object Oriented Programming With C++, 7th Edition, Mc Graw Hill India.
6.
A. S. Saud, C++ Programming with Object Oriented Approach, 2nd Edition, KEC Publication and Distributor.
Labrotary Work
Lab Sheet#1
1.
Write programs to demonstrate insertion & extraction operators, manipulators, and dynamic memory management.
2.
Write a programs to demonstrate default arguments, inline function, and function overloading.
Lab Sheet#2
1.
Write programs to demonstrate class, object, array of objects, and pointer objects.
2.
Write programs to demonstrate constructor and destructor.
3.
Write programs to demonstrate static members, this pointer, friend function, and friend class.
Lab Sheet#3
1.
Write programs to demonstrate unary operator overloading.
2.
Write programs to demonstrate binary operator overloading
3.
Write programs to demonstrate type conversions.
Lab Sheet#4
1.
Write programs to demonstrate access specifiers and different types of inheritances.
2.
Write programs to demonstrate constructor and destructors in inheritance.
3.
Write programs to demonstrate public and private derivation.
4.
Write programs to demonstrate ambiguities and inheritance and their solution.
Lab Sheet#5
1.
Write programs to demonstrate run time polymorphism.
Lab Sheet#6
1.
Write programs to demonstrate function and class templates.
2.
Write programs to demonstrate try, catch, and throw statements.
3.
Write programs to demonstrate multiple catch blocks.
Lab Sheet#7
1.
Write programs to demonstrate reading and writing text and binary files.
2.
Write programs to demonstrate reading and writing objects.
3.
Write programs to demonstrate random access in files.