You are on page 1of 13

OBJECT ORIENTED

PROGRAMMING
Steve Clar
CHAPTER 1
THE BIG PICTURE
• PROCEDURAL VERSUS OBJECT-ORIENTED LANGUAGES
• FEATURES OF OBJECT-ORIENTED LANGUAGES
• INTRODUCTION TO CLASSES AND OBJECTS
• INTRODUCTION TO INHERITANCE
• C++ AND C
WHY DO WE NEED
OBJECT-ORIENTED
PROGRAMMI
NG?
PROCEDURAL LANGUAGES
 Pascal, C, BASIC, Fortran, and similar languages are procedural languages.

 A program in a procedural language is a list of instructions


DIVISION INTO FUNCTIONS
 The idea of breaking a program into functions can be further extended by grouping a number

of functions together into larger entity called a module.

 Dividing a program into functions and modules is one of the cornerstone of structured
programming , the somewhat loosely defined discipline that has influenced programming
organization for more than a decade.
PROBLEMS WITH STRUCTURED
PROGRAMMING
 As programs grow ever larger and more complex, even the structured programming

approach begin to show sign of strain.

WHAT ARE THE REASONS FOR THESE


FAILURE OF PROCEDURAL LANGUAGES?
 Data Undervalued

 Relationship to the real world

 New Data Types


THE OBJECT-ORIENTED
APPROACH
 Combine into a single unit both data and the functions that operate on that data. Such a unit is

called object.

 An object’s functions, called member functions in C++, typically provide the only way to

access its data.

 Data Encapsulation and Data Hiding are the key terms in the description of object-oriented

languages.
OOP: AN APPROACH TO
ORGANIZATION
 Object-oriented programming is not primarily concerned with the details of program
operation. Instead, it deals with the overall organization of the program
CHARACTERISTICS OF
OBJECT-ORIENTED
PROGRAMMING
• OBJECTS
• CLASSES
• INHERITANCE
• REUSABILITY
OBJECT
 Programming Constructs
 Customized Array

 Stack

 Linked List

 Binary Trees

 Physical Objects

 Automobiles in a traffic-flow simulation

 Electrical components in a circuit-design program

 Countries in an economic model

 Aircraft in an air-traffic-control system


CLASSES
 Objects are member of classes.

INHERITANCE
 Analogous to using functions to simplify a traditional procedural program.
C++ AND C
 C++ is derived from the C language.
SUMMARY
 OOP is a way of organizing programs.

You might also like