0% found this document useful (0 votes)
2 views

Lecture 2 What is object oriented programming

Object-oriented programming (OOP) is a technique that mirrors human problem-solving by identifying objects and their interactions to address real-world issues. The approach involves four steps: identifying the problem, the necessary objects, the messages to be sent, and the sequence of those messages. Key components of OOP include objects, which are instances of classes with defined interfaces and hidden implementations, and classes, which serve as blueprints for creating objects that include both data and functions.

Uploaded by

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

Lecture 2 What is object oriented programming

Object-oriented programming (OOP) is a technique that mirrors human problem-solving by identifying objects and their interactions to address real-world issues. The approach involves four steps: identifying the problem, the necessary objects, the messages to be sent, and the sequence of those messages. Key components of OOP include objects, which are instances of classes with defined interfaces and hidden implementations, and classes, which serve as blueprints for creating objects that include both data and functions.

Uploaded by

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

What is object oriented programming?

It is a programming technique to solve real world problems

Object-oriented problem solving approach is very similar to the way a human solves daily
problems. It consists of identifying objects and how to use these objects in the correct sequence
to solve the problem. In other words, object-oriented problem solving can consist of designing
objects whose behavior solves a specific problem. A message to an object causes it to perform its
operations and solve its part of the problem.

The object-oriented problem solving approach, in general, can be devided into four steps. They
are: (1) Identify the problem, (2) Identify the objects needed for the solution, (3) Identify
messages to be sent to the objects, and (4) Create a sequence of messages to the objects that
solve the problem.

Objects:-Objects are the basic unit of OOP. They are instances of class, which have data
members and uses various member functions to perform tasks. Object has an interface and an
implementation, interface is given to user and implementation is hidden, examples are breaks
(interface) of any vehicle is same but internal implementation is different for different vehicles,
benefit= no worry for user. Means Separation of Interface & Implementation, A driver can apply
brakes independent of brakes type (Cylindrical, disk), Again, reason is the same interface.

Messages:-Objects communicate through messages. They send messages (stimuli) by invoking


appropriate operations on the target object. The number and kind of messages that can be sent to
an object depends upon its interface. Examples are

• A Person(sender) sends message “stop” to a Car (receiver) by applying brakes


• A Person sends message “place call” to a Phone by pressing appropriate button

Class:-It is similar to structures in C language. Class can also be defined as user defined data
type but it also contains functions in it. So, class is basically a blueprint for object. It declare &
defines what data variables the object will have and what operations can be performed on the
class's object.

Structures only contain data but classes contain functions also.

You might also like