Lecture 2 What is object oriented programming
Lecture 2 What is object oriented programming
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.
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.