22
Object Oriented Programming in C++ Instructor: Ms. Monika Kumari CSE (A + B) IV semester

Preamble Lecture

Embed Size (px)

Citation preview

Page 1: Preamble Lecture

Object Oriented Programming in C++

Instructor:Ms. Monika Kumari

CSE (A + B) IV semester

Page 2: Preamble Lecture

Preamble

• Course Syllabus• Reference Text Book• Evaluation Process• Introduction• Utility and Its Application• Conclusion

Page 3: Preamble Lecture

Course Syllabus

• UNIT – I : Object oriented paradigm • UNIT – II : Classes and objects • UNIT – III : Inheritance• UNIT – IV : Virtual functions• UNIT –V : Exception handling

Page 4: Preamble Lecture

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.

Page 5: Preamble Lecture

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.

Page 6: Preamble Lecture

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.

Page 7: Preamble Lecture

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.

Page 8: Preamble Lecture

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.

Page 9: Preamble Lecture

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.

Page 10: Preamble Lecture

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]

Page 11: Preamble Lecture

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

Page 12: Preamble Lecture

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]

Page 13: Preamble Lecture

Introduction

Page 14: Preamble Lecture

Programming Techniques

• Unstructured or Monolithic programming• Procedural programming• Modular programming• Object oriented programming

Page 15: Preamble Lecture

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

Page 16: Preamble Lecture

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

Page 17: Preamble Lecture

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

Page 18: Preamble Lecture

Continued

Module 2DataDataM2 StatementsStatements

StatementsStatements

DataDataM1 Statements

Statements

Procedure 1

Module 1

Procedure 2

Procedure 3

Page 19: Preamble Lecture

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.

Page 20: Preamble Lecture

Class Structure

Object Data Function1 Function2

Page 21: Preamble Lecture

Next class

• Why do we need Object Oriented Programming?

• Procedural vs Object Oriented Programming• Features of OOPs

Page 22: Preamble Lecture

THANKS…..