Object Oriented Programming in C++
Instructor:Ms. Monika Kumari
CSE (A + B) IV semester
Preamble
• Course Syllabus• Reference Text Book• Evaluation Process• Introduction• Utility and Its Application• Conclusion
Course Syllabus
• UNIT – I : Object oriented paradigm • UNIT – II : Classes and objects • UNIT – III : Inheritance• UNIT – IV : Virtual functions• UNIT –V : Exception handling
Unit I
• Object oriented paradigm : Evolution of programming paradigm, structured versus object-
oriented development, elements of object-oriented programming, objects, classes .
Introduction to C++ : Introduction, hello world, streams based I/O, single line comment, literals – constant qualifiers, scope resolution operator (::), variable definition at the point of use, variable aliases-reference variables, strict type checking, parameters passing by reference, inline function, function overloading, default arguments, keyword typedef, functions as part of struct, type conversion, function templates, runtime memory management.
Unit II
• Classes and objects: Introduction, class specification, class objects, accessing class members, defining
member functions, outside member functions as inline, accessing member functions within a class, data hiding, access boundary of objects revisited, empty classes, pointers within a class, passing objects as arguments, returning objects from functions, friend functions and friend classes, constant parameters and member functions, structures and classes, static data and member functions, class, objects and memory resource, class design steps.
Operator overloading: Introduction, over loadable operators, unary operator overloading, operator keyword, operator return values, nameless temporary objects, limitations of increment/decrement operators, binary operator overloading, arithmetic operators, concatenation of strings, comparison operators, arithmetic assignment operators, overloading of new and delete operators, data conversion, conversion between basic data types, conversion between objects and basic types, conversion between objects of different classes, subscript operator overloading, overloading with friend functions, assignment operator overloading, tracing memory links.
Unit III
• Inheritance: Introduction, class revised, derived class
declaration, forms of inheritance, inheritance and member accessibility, constructors in derived classes, destructors in derived classes, constructors invocation and data members initialization, overloaded member functions, abstract classes, multilevel inheritance, multiple inheritance, hierarchical inheritance, multipath inheritance and virtual base classes, hybrid inheritance.
Unit IV
• Virtual functions: Introduction, need for virtual functions,
pointer to derived class objects, definition of virtual functions, array of pointers to base class objects, pure virtual functions, abstract classes, virtual destructors.
Unit V
• Exception handling: Introduction, error handling, exception handling
model, exception handling constructs, handler throwing the same exception again, list of exceptions, catch all exceptions, exceptions in constructors and destructors, handling uncaught exceptions, exceptions in operator overloaded functions, exception in inheritance tree, exceptions in class templates, fault tolerant design techniques, case-study on software fault tolerance, memory allocation failure exception.
Reference Book
• Books:Budd,”Object Oriented Programming “, Addison
Wesley. Mastering C++ K.R Venugopal Rajkumar, TMH. Computer Science (a Structured approach using
C++), B.A. Forouzan & R.F. Gillberg, CENGAGE Learning.
C++ Primer, “Lip man and Lajole”, Addison Wesley. Balagurusami, “Object oriented with C++”, TMH.
Evaluation Process
• Class Assessment 40%• Mid Term 20%• End Term 40%• Your All Study materials be posted after each lecture at
our Yahoo Group • Group name: OOPs_Csharda15 • Group home page: http://in.groups.yahoo.com/group/OOPs_Csharda15 • Group email: [email protected]
Instructor
Name: Ms. Monika Kumari Assistant Professor, CSE DepttOffice: 4th cabin on 5th floor, SDS Building Sharda University.Email: [email protected] hour: 12:00 – 2:30 pmTeaching Assitant: Ms. Palvi GuptaOffice: 5th Floor, SDS Building, Sharda University
LABs & Tutorials
• For lab and tutorial CS A and CS B are divided into groups.
• CS A have two groups : lab in 314 [G1,1/2G2]-> 090101001 to 090101060 [1/2G2, G3]->090101061 to 090101121 CS B have also two groups :lab in 321 [G1] -> 090101801 to 090101155[Monika Kumari] [G2] -> 090101156 to 090101198[Palvi Gupta]
Introduction
Programming Techniques
• Unstructured or Monolithic programming• Procedural programming• Modular programming• Object oriented programming
Monolithic Programming
Program consists of global data and statement which modify the data and finally it contains the output statements.
Such programs are lengthy ,Difficult to debug and
difficult to maintain.
//Main programDataStatement 1Statement 2Statement---------------Statement 1Statement 2end
Procedural Programming• Group of statements that carry out similar
action at several places in the program such a group is taken out the main program and is placed in a subprogram called subroutine or procedure or function
• A procedural program is more structured . • The different procedure or subroutine can
be checked independently of the main program , thus debugging become easier
• Also easier to maintain the program• The drawback is that if the subroutine is
small and is called many times in the program , the overload of calling makes the program inefficient.
// main programGlobal data Procedure 1 or SubroutineStatement Statement
Statement Statement……………… ……………. StatementStatementStatementStatement………………. Procedure 2Statement StatementStatement Statement
Statement……………….Statementend
Modular Programming
• In this type of programming the similar procedure are grouped together into modules. Thus the whole program may consist of modules and connecting statements.
• The main program supplies data and co- ordinates the different modules .
// main programData Statements
Statements--------------Statements
Statements
Module 1
Module 2
Continued
Module 2DataDataM2 StatementsStatements
StatementsStatements
DataDataM1 Statements
Statements
Procedure 1
Module 1
Procedure 2
Procedure 3
Object Oriented Programming
• The important factor of this technique is Data Abstraction.
• Different procedures and functions are built around the abstract data
• Thus the data and functions are encapsulated in a single structure called “Class”.
• In class different functions are defined according to the data that an object of the class must have.
Class Structure
Object Data Function1 Function2
Next class
• Why do we need Object Oriented Programming?
• Procedural vs Object Oriented Programming• Features of OOPs
THANKS…..