Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Lecture 1

Data Structures and Object oriented Programming


Explanation
 Object Oriented programming is method of programming where -
a system is considered as a collection of objects that interact
together to accomplish certain tasks. Objects are entities that
encapsulate data and procedures that operate on the data.
 In OOPS first a concept known as "Object Oriented Analysis (OOA)" is
used to specify the objects in term of real world requirements, their
behavior and interactions required. The next concept would be the
"Object Oriented Design (OOD)" that converts these real-time
requirements as a hierarchy of objects in terms of software
development requirement. Finally OOPS is used to implement the
requirements using the C++ programming language.

CNTD….

 The main purpose of object oriented programming is to simplify the design,


programming and most importantly debugging a program.
 So to modify a particular data, it is easy to identify which function to use.
 To add additional features it is easy to identify where to add functions and its
related data.
The C++ language

 An object-oriented, general-purpose programming language, derived


from C (C++ = C plus classes).

 C++ adds the following to C:

1. Inlining and overloading of functions.


2. Default argument values.
3. Argument pass-by-reference.
4. Support for object-oriented programming, through classes,
information hiding, public interfaces, operator overloading,
inheritance, and templates.
Design Objectives in C++

 Compatibility. Existing code in C can be used. Even existing, pre-


compiled libraries can be linked with new C++ code.

 Efficiency. No additional cost for using C++. Overheadof function


calls is eliminated where possible.

 Strict type checking. Aids debugging, allows generation of efficient


code.

 C++ designed by Bjarne Stroustrup of Bell Labs (now at TAMU).

 Standardization: ANSI, ISO.


BASIC ELEMENTS OF OOPS

 Following are the basic elements of Object oriented


programming(OOPS)

 Object
 Classes
 Inheritance
 Dynamic Binding
 Polymorphism
 Message Passing
 Encapsulation
Object-Oriented Programming
Object-oriented programming is a programming methodology characterized by the following
concepts:

1. Data Abstraction: problem solving via the formulation of abstract data types (ADT's).

2. Encapsulation: the proximity of data definitions and operation definitions.

3. Information hiding: the ability to selectively hide implementation details of a given ADT.

4. Polymorphism: the ability to manipulate different kinds of objects, with only one
operation.

5. Inheritance: the ability of objects of one data type, to inherit operations and data from
another data type. Embodies the "is a" notion: a horse is a mammal, a mammal is a
vertebrate, a vertebrate is a lifeform.
O-O Principles and C++ Constructs

O-O Concept C++ Construct(s)

Abstraction Classes
Encapsulation Classes
Information Hiding Public and Private Members
Polymorphism Operator overloading,
templates, virtual functions
Inheritance Derived Classes
Objects

 Explanation

Objects are instance of a class, that interact with


each other at runtime. In OOPs, Objects are
declared at the end of the class definition or after
the "}" braces. They can be of any type based on its
declaration
Classes

 Explanation : has the data and its associated function wrapped in it.
Classes are also known as a collection of similar objects or objects of same
type. In the OOPs concept the variables declared inside a class are known as
"Data Members" and the functions are known as "Member Functions".

You might also like