Sie sind auf Seite 1von 10

Object Oriented Programming C++

Subject Code:

BCA 2030/IMC 2030/MCA 2030

Edition: Fall 2012

BKID B1641

Sikkim Manipal University


Directorate of Distance Education
Department of Information Technology
Dean
Directorate of Distance Education
Sikkim Manipal University (SMU DDE)
Board of Studies
Chairman
Head IT
SMU DDE, Manipal 576 104
Additional Registrar
SMU DDE
Manipal 576104
Addl. Registrar (S.E.)
Office of the Student Evaluation
Manipal 576104
Director
SMU-DDE, Bangalore
Dr. N.V.S. Subba Reddy
Vice- Chancellor, Mody Institute of
Technology and Science, Lakshmangarh,
Rajasthan
Dr. Ramprasad Vardhachar
Director, Computer Studies
Dayanand Sagar Institutions, Bangalore
Mr. Chitta Prasad
Senior Consultant, Technology Excellence
Group for Insurance and healthcare,
TCS, Bangalore

Mrs. Vidya Selvaraj


Asst. Prof., Dept. of IT
SMU-DDE, Bangalore
Dr. A. Kumaran
Research Manager, Multilingual
Research, Microsoft (India)
Mr. Ashwin Krishna
Director, Keystone Business
Bangalore
Prof. A Srinivas
Director Research and Consultancy
and Professor of Computer Science
PES Institute of Technology,
Bangalore
Dr. Rajasekar
Image Quality Leader
Wipro - GE (India), Bangalore
Dr. Ashok Kumar T.K.
General Manager
IBM (India), Bangalore

Edition: Fall 2012


Printed: July 2012
This book is a distance education module comprising a collection of learning
material for our students. All rights reserved. No part of this work may be
reproduced in any form by any means without permission in writing from Sikkim
Manipal University, Gangtok, Sikkim. Printed and published on behalf of Sikkim
Manipal University, Gangtok, Sikkim by Mr. Rajkumar Mascreen, GM, Manipal
Universal Learning Pvt. Ltd., Manipal 576 104. Printed at Manipal Technologies
Limited, Manipal.

Authors Profile
Ms. Pallavi Upadhyaya, Assistant Professor, MIT, Manipal. She has been teaching
various Information Systems area courses for the past 10 years. She has taught
courses such as Computer Application in Management, Management Information
Systems, E-business, Hospital and Health Information Systems, Database Systems
and Object Oriented Programming system.
Mr. Vittaldas Prabhu, Assistant professor MIT, Manipal. His area of specialization
includes object oriented programming concepts, software Engineering and
computer Networks.
In House Technical Team
Mr. C.V. Uppin, Assistant professor in Dept. of IT, Sikkim Manipal.

Contents
Unit 1
Evolution of Programming Methodologies

Unit 2
Iteration Statements Array and Strings

22

Unit 3
Functions

49

Unit 4
Creating Classes and Abstraction

67

Unit 5
Constructors and Destructors

90

Unit 6
Operator Overloading in C++

104

Unit 7
Inheritance in C++

118

Unit 8
Multiple Inheritance and Virtual Functions

135

Unit 9
Files and Streams in C++

152

Unit 10
Standard Input and Output Operations

165

Unit 11
File Input and Output

179

Unit 12
Class Templates

204

Unit 13
Standard Template Library

227

Unit 14
Exception Handling

248

BCA 2030/ IMC 2030/MCA 2030


Object Oriented Programming C++
SUBJECT INTRODUCTION
This SLM is designed to cover the fundamentals Object Oriented
Programming concepts using C++ language. C++ is a general-purpose,
middle-level programming language with high-level and low-level
capabilities. It is a statically typed free-form multi-paradigm language,
supporting procedural programming, data abstraction, object-oriented
programming, and generic programming. Since the 1990s, C++ has been
one of the most popular commercial programming languages. The term
middle-level does not imply that C++ is less powerful, harder to use, or less
developed than high-level languages, nor that it has the cumbersome nature
of low-level languages. Rather it combines the best elements of high-level
languages with the flexibility of assembly language. The intention of having
this book is to provide a detailed description of a few advanced concepts in
C++ that may be used in our daily lives to write better programs than before
This SLM has been split into 14 units to cover the basic concepts of OOPS
using C++, overview of which are given below:
Unit 1: Evolution of Programming Methodologies
This unit covers the highlights of the object oriented programming
emphasizing its importance over procedural languages.
Unit 2: Iteration Statements Array and Strings
This unit focuses on Iteration statements in C++ and the concept of arrays
and strings to explain basic data structure which helps in grouping data of
similar type.
Unit 3: Functions
This unit explain us the s the grouping of program statements through
functions and grouping dissimilar data using structures.
Unit 4: Creating Classes and Abstraction
This unit introduces us the concept of objects and classes that are building
blocks of OOP. Also explains the role of abstract class in C++ language.

Unit 5: Constructors and Destructors


This unit speaks about the special function called constructor, how many
types are there to invoke the constructor. How the memory can be
deallocated using destructor for the memory allocated by the constructor.
Unit 6: Operator Overloading in C++
This unit explores, how basic operators can be used differently with user
defined classes and make the program more readable.
Unit 7: Inheritance in C++
This unit deals with the concept of inheritance and how it supports code
reuse.
Unit 8: Multiple Inheritance and Virtual Functions
This unit is to brush-up the readers fundamentals on Inheritance, Virtual
Functions, and Polymorphism. This unit should be able to drive the reader to
hunt for more knowledge on the concepts touched upon.
Unit 9: Files and Streams in C++
This unit describes in detail the very useful and featureful iostream library
offered by C++. This unit is studded with examples that will help the reader
in understanding the concept of file I/O with streams.
Unit 10: Standard input and Output Operations
This unit also helps the reader in understanding how he/she may be able to
organize (format) output using manipulators.
Unit 11: File Input and Output
This unit focuses on what are different methods available which supports
the input and output operations on file.
Unit 12: Class and Templates
Templates are a very useful and extremely indispensable feature of C++. A
lot of programming effort can be saved by the use of templates. This unit
describes templates, template programming, and the usage considerations
of templates, with the help of a myriad of examples to illustrate the
concepts.

Unit 13: Standard Template Library


Another step towards efficient programming is achieved by the use of
Standard Template Library (STL). This unit introduces the reader to STL.
Furthermore, this unit provides minute details on all of the STL components
with relevant examples to show how these components can be used in
programs.
Unit 14: Exception Handling.
Every programmer describes his/her program to be error-free. But errors still
pop up. How to gracefully handle these errors (or exceptions) is what
exception handling is all about. This unit comprehensively describes
exception handling along with useful examples. This unit also introduces the
readers to standard exceptions, and also teaches how to create userdefined exceptions.

Das könnte Ihnen auch gefallen