Department of MCA LECTURE NOTE ON OBJECT-ORIENTED PROGRAMMING USING C++ (MCA 2nd Sem) COURSE CODE: MCA-108 Prepared by : Mrs. Sasmita Acharya Assistant Professor Department of MCA VSSUT, Burla.
MCA-108 Object Oriented Programming using C++ L-T-P: 3-1-0 Prerequisite: Basic knowledge of object oriented programming. UNIT I: (10 Hours) Introduction to object oriented programming, user defined types, polymorphism, and encapsulation. Getting started with C++ - syntax, data-type, variables, strings, functions, exceptions and statements, namespaces and exceptions operators. Flow control, functions, recursion. Arrays and pointers, structures. UNIT II: (10 Hours) Abstraction Mechanisms: Classes, private, public, constructors, destructors, member functions, static members, references etc. class hierarchy, derived classes. Inheritance: simple inheritance, polymorphism, object slicing, base initialization, virtual functions. UNIT III: (12 Hours) Prototypes, linkages, operator overloading, ambiguity, friends, member operators, operator function, I/o operators etc. Memory management: new, delete, object copying, copy constructors, assignment operator, this Input/Output. Exception handling: Exceptions and derived classes function exception declarations, Unexpected exceptions. Exceptions when handling exceptions, resource capture and release etc. UNIT – IV: (8 Hours) Templates and Standard Template library: template classes declaration, template functions, namespaces, string, iterators, hashes, iostreams and other type. Design using C++ design and development, design and programming, role of classes. Text Book: 1. E. Balaguruswamy, Object-Oriented Programming in C++. 4 ed, Tata McGraw-Hill. 2. Ashok N. Kamthane, Object-Oriented Programming with ANSI & Turbo C++, Pearson Education. Reference Books: 1. Herbert Schildt, The Complete Reference C++. 4 ed, Tata McGraw-Hill. 2. Bjarne Stroustrup, Programming: Principles and Practice Using C++. 4 ed, AddisonWesley. -----Course Outcomes: 1. Familiar to map real world problems into the Programming language using objects. 2. Can solve the problems in systematic way using class and method paradigms. 3. Efficiently implement linear, nonlinear data structures and various searching and sorting techniques. 4. Efficiently implement Exception handling techniques.
CONTENTS 1. INTRODUCTION 1.1 Features 1.2 Advantages 1.3 Uses of OOP 2. INPUT AND OUTPUT IN C++ 2.1 pre-defined streams 2.2 stream classes 2.3 Typecasting 3. C++ DECLARATION 3.1 Parts of C++ program 3.2 Token 3.3 Data types in C++ 3.3.1 Basic data types 3.3.2 Derived data type 3.3.3 User defined data type 3.3.4 Void data type 3.4 Operators in C++ 4. FUNCTIONS IN C++ 4.1 Passing Arguments a) Call by value(pass by value) b) Call by address(pass by address) c) Call by reference(pass by reference) 4.2 Default Arguments 4.3 Inline functions 4.4 Function overloading 4.5 Library function 4.6 Const Argument 5. CLASSES & OBJECTS 5.1 Introduction 5.2 Declaring objects 5.3 Defining member function 5.4 Declaring member function outside the class 5.5 Static member variable 5.6 Static member function 5.7 Static object 5.8 Object as function arguments 5.8.1 pass-by value 5.8.2 pass-by reference 5.8.3 pass by address 5.9 Friend function 5.10 Friend classes 5.11 Constant member function
5.12 5.13 5.14 5.15 5.16 Recursive member function Member function & non-member function Overloading member function Overloading main() function Indirect recursion 6. CONSTRUCTOR AND DESTRUCTOR 6.1 Constructor with Arguments 6.2 Constructor overloading 6.3Constructor with default Argument 6.5 Copy Constructor 6.6Const Object 6.7 Destructor 6.8 Qualifier & Nested classes 6.9 Anonymous object 6.10 Private Constructor and Destructor 6.11 main() as constructor & destructor 6.12 Local vs Global Object 7. INHERITANCE 7.1 Types of Inheritance 7.1.1 Single Inheritance 7.1.2 Multiple Inheritance 7.1.3 Hierarchical Inheritance 7.1.4 Multilevel Inheritance 7.1.5 Hybrid Inheritance 7.1.6Multipath Inheritance 7.2 Container class 7.3 Abstract class 7.4 Common constructor 7.5Pointer & Inheritance 7.6 Overloading Member function 8. OPERATOR OVERLOADING 8.1 Introduction 8.2 Overloading Unary operator 8.3 Overloading binary operator using friend function 8.4 Overloading increment & decrement operator 8.5 Overloading special operator 8.6 Overloading function call operator 8.7 Overloading class member access operator 8.8 Overloading comma operator 8.9 Overloading stream operator 8.10 Overloading extraction & insertion operator 9. POINTERS AND ARRAY 9.1 Void pointer 9.2 Wild pointer