0% found this document useful (0 votes)
79 views25 pages

3 Slide Oop

Object-oriented programming (OOP) represents real-world objects like numbers, text, pictures, and sounds as objects that contain data properties and related methods. A class defines the type of an object by grouping together its properties and methods. Instances of a class are individual objects created from that class that can have different property values but share the same properties and methods. OOP helps manage complexity by modeling systems as collections of interacting objects.

Uploaded by

Saim Chaudhary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views25 pages

3 Slide Oop

Object-oriented programming (OOP) represents real-world objects like numbers, text, pictures, and sounds as objects that contain data properties and related methods. A class defines the type of an object by grouping together its properties and methods. Instances of a class are individual objects created from that class that can have different property values but share the same properties and methods. OOP helps manage complexity by modeling systems as collections of interacting objects.

Uploaded by

Saim Chaudhary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Object-Oriented Programming

Lecture 4A – Object-Oriented Programming


(OOP)

Ubaid Ur Rehman
[email protected]
Structured Programming

MAIN PROGRAM GLOBAL DATA

FUNCTION FUNCTION 2 FUNCTION 3


1

FUNCTION 4 FUNCTION 5
Structured Programming

™  Using function
™  Function & program is divided into modules
™  Every module has its own data and function
which can be called by other modules.
Object-Oriented Programming

Object 1 Object 2

Data Data

Function Function

Object 3

Data

Function
Object-Oriented Programming

™  Objects have both data and methods


™  Objects of the same class have the same data
elements and methods
Object-Orientation
™  A thinking methodology
™  Everything is an object.
™  Any system is composed of objects (a system is
also an object).
™  The evolution and development of a system is
caused by the interactions of the objects inside/
outside a system.
Programming Techniques
™  The evolution of programming techniques is
™  to make languages more expressive
™  to control complex systems more easily
Object-Oriented Programming

Computer scientists have


introduced the notion of
objects and object-
oriented programming to
help manage the growing
complexity of modern
computers.
Object-Oriented Programming

™  An object is anything that can be represented


by data in a computer’s memor y and
manipulated by a computer program.

Numbers
Object-Oriented Programming

™  An object is anything that can be represented


by data in a computer’s memor y and
manipulated by a computer program.

Text
Object-Oriented Programming

™  An object is anything that can be represented


by data in a computer’s memor y and
manipulated by a computer program.

Pictures
Object-Oriented Programming

™  An object is anything that can be represented


by data in a computer’s memor y and
manipulated by a computer program.

Sound
Object-Oriented Programming

™  An object is anything that can be represented


by data in a computer’s memor y and
manipulated by a computer program.

Video
Object-Oriented Programming
™  An object is anything that can be represented
by data.
Object-Oriented Programming

™  An object can be
something in the
physical world or even
just an abstract idea.
™  A n a i r p l a n e , f o r
example, is a physical
object that can be
manipulated by a
computer.
Object-Oriented Programming

™  An object can be
something in the
physical world or even
just an abstract idea.
™  A bank transaction is
an example of an
object that is not
physical.
Example: A “Rabbit”
Object
™  You could (in a game, for example) create an
object representing a rabbit
™  It would have data:
™  How hungry it is
™  How frightened it is
™  Where it is
™  And methods:
™  eat, hide, run, dig
Object-Oriented Programming:
Terminology
™  T h e d a t a t h a t Name: PA 3794

represent the object Owner: US Airlines

are organized into a Location: 39 52′ 06″ N  75 13′ 52″ W


Heading: 271°
set of properties.
Altitude: 19 m
™  The values stored in AirSpeed: 0
an object’s properties Make: Boeing
at any one time form Model: 737

the state of an object. Weight: 32,820 kg


Object-Oriented Programming:
Terminology
™  Computer programs
i m p l e m e n t
algorithms that
manipulate the data.
™  In object-oriented
programming, the
programs that
manipulate the
proper ties of an
object are the object’s
methods.
Object-Oriented Programming:
Terminology
™  We can think of an
object as a collection
of properties and the
methods that are
used to manipulate
those properties.
Properties or attributes
Methods or functions
Object-Oriented Programming:
Terminology
™  A class is a group of
objects with the same
properties and the
same methods.
Object-Oriented Programming:
Terminology
™  Each object of a
class is known as an
instance of its class
™  Each copy of an
object from a
particular class is
called an instance of
the object.
Object-Oriented Programming:
Terminology
™  The act of creating a
new instance of an
object/class is called
instantiation.
Object-Oriented Programming:
Terminology
™  T w o d i f f e r e n t
instances of the same
class will have the
same properties, but
dif ferent values
stored in those
properties.
Object-Oriented Programming

Object Property

The same terminology


is used in most object-
Method Instantiation
oriented programming
languages.
Class
Instance State

You might also like