oops mid
I Year B.Tech II SEM Overview
Course Code: R18A0502
Credits: L 4, T/P/D 1/-/-
Total Credits: 3
Objectives
Understand concepts of Object Oriented Programming (OOP) versus Procedure Oriented Programming (POP).
Distinguish between functions, classes, and objects.
Learn to overload functions and operators.
Design applications using dynamic memory management techniques.
Implement generic programming and exception handling.
Unit I: Introduction to Object Oriented Programming
Object-Oriented Paradigm
OOP vs. Procedure-Oriented Programming (POP): OOP is based on objects while POP is based on functions.
Basic Concepts: Encapsulation, Inheritance, Polymorphism.
Benefits of OOP include code reusability, maintainability, and scalability.
Structure of a C++ program includes namespaces, data types, tokens, identifiers, variables, constants, operators, control structures & loops.
Unit II: Functions, Classes, and Objects
Classes and Objects
Class Definition: Data members and member functions.
Access Control: Public, Private, Protected.
Static Data Members and Functions: Understand memory allocation nuances.
Arrays of Objects: Declaring and using arrays of classes.
Friend Functions: Functions that can access private members of a class.
Unit III: Constructors, Destructors, Inheritance
Constructors and Destructors
Types of Constructors: Default, Parameterized, Copy.
Destructors: Clean up resources.
Inheritance
Types: Single, Multiple, Multi-level, Hierarchical, Hybrid.
Derived classes inherit properties from base classes and can extend functionality.
Unit IV: Pointers, Virtual Functions, and Polymorphism
Memory Management: Using
newanddeleteoperators.Pointers
Pointer to objects, pointers to derived classes.
Polymorphism:
Compile Time vs. Run Time Polymorphism.
Virtual functions and their role in dynamic binding.
Function and Operator Overloading: Mechanism and syntax.
Unit V: Templates and Exception Handling
Templates
Class and Function Templates with examples.
Templates allow creating functions and classes with generic types.
Exception Handling
Basics: Try, Catch, and Throw mechanism.
Types of Exceptions: Standard exceptions and user-defined exceptions.
Outcomes
Differentiate OOP and POP.
Construct classes, functions, and manage object-oriented programming.
Implement constructors, destructors, and inheritance in C++.
Apply exception handling and generic programming techniques.
Recommended Textbooks
Object Oriented Programming with C++ by Balagurusamy
C++, the Complete Reference, 4th Edition by Herbert Schildt
References
C++ Primer, 3rd Edition by S.B. Lippman and J. Lajoie
The C++ Programming Language, 3rd Edition by B. Stroustrup
Detailed Concepts in Object Oriented Programming
Concepts of OOP
Encapsulation: Bundling data and methods that operate on the data within a class.
Data Abstraction: Hiding complex reality while exposing only the necessary parts.
Polymorphism: The ability to process objects differently based on their data type or class.
Inheritance: Mechanism by which one class can inherit properties and methods from another.
Dynamic Binding: Resolving function calls at runtime.
Message Passing: Objects communicate by sending messages to one another.
Differences Between OOP and POP
OOP uses objects; POP uses functions.
OOP emphasizes data encapsulation; POP emphasizes procedure.
OOP supports inheritance and polymorphism; POP does not.
OOP is more secure with access specifiers; POP lacks this feature.
Basic Structure of C++ Program
Documentation Section: Program objectives, authors, logic explained within comments.
Linking Section: Include header files and libraries.
Definition Section: Define constants and macros.
Global Declaration Section: Global variables and class definitions.
Member Function Definition: Define the functions that implement the logic.
Main Function: Entry point for program execution.
Data Types
Primary Data Types: int, char, float, double, bool, void.
Derived Data Types: arrays, pointers, references.
User-defined Data Types: structures, unions, and enumerations.
C++ Tokens
Identifiers: Names for variables, functions, and arrays with rules for declaration.
Keywords: Reserved words for constructed statements.
Constants: Unchangeable values during program execution, distinguishing primary and secondary constants.
Operators and Expressions
Four types of operators: Arithmetic, relational, logical, and conditional.
The concept of expressions formed by operands and operators in C++.
Control statements to manage the flow of the program, including sequential, conditional, and looping constructs.