Chapter 1: Fundamentals of Object-Oriented Programming
1.1 Object Oriented Programming (OOP) is an approach to program organization and development,
which attempts to eliminate some of the pitfalls of conventional programming methods. OOP allows us
to decompose a problem into several entities called Objects and then build data and functions (known
as methods in Java) around the entities. The combination of data and methods make up an object.
Object = Data + Methods
The data of an object can be accessed only by the methods associated with that object.
1.1.1 Features:
Emphasis is on data rather than procedure.
Programs are divided into what are known as Objects
Data structures are designed such that they characterize the objects.
Methods that operate on the data of an object are tied together in the data structure.
Data is hidden and cannot be accessed by external functions.
Objects may communicate with each other through methods.
New data and methods can be easily added whenever necessary.
Follows bottom-up approach in program design
1.2 Basic Concepts of OOP
Objects: Objects are runtime entities in an object-oriented system. They may represent a person, a
place, a bank account, a table of data or any item that the program may handle.
Classes: The entire set of data and code of an object can be made a user-defined data type using the
concept of a class. A class may be thought of as a “Data type” and an object as a variable of that data
type. Once a class has been defined, we can create any number of objects belonging to that class. Each
object is associated with the data of type class with which they are created.
Data Abstraction: Abstraction refers to the act of representing essential features without including the
background details or explanations. Classes use the concept of abstraction and are defined as a list of
abstract attributes such as size, weight and cost, and methods that operate on these attributes.
Encapsulation: The wrapping up of data and methods into a single unit (called class) is known as
encapsulation. The data is not accessible to the outside world and only those methods, which are
wrapped in the class, can access it. These methods provide the interface between the object’s data and
the program. This insulation of the data from direct access by the program is called data hiding.
Encapsulation makes it possible for objects to be treated like “black boxes”, each performing a specific
task without any concern for internal implementation.
Inheritance: Inheritance is the process by which objects of one class acquire the properties of objects of
another class. In OOP, the concept of inheritance provides the idea of reusability. This means that we
can ass additional features to an existing class without modifying it. this is possible by deriving a new
class from the existing one.
1.1 Object Oriented Programming (OOP) is an approach to program organization and development,
which attempts to eliminate some of the pitfalls of conventional programming methods. OOP allows us
to decompose a problem into several entities called Objects and then build data and functions (known
as methods in Java) around the entities. The combination of data and methods make up an object.
Object = Data + Methods
The data of an object can be accessed only by the methods associated with that object.
1.1.1 Features:
Emphasis is on data rather than procedure.
Programs are divided into what are known as Objects
Data structures are designed such that they characterize the objects.
Methods that operate on the data of an object are tied together in the data structure.
Data is hidden and cannot be accessed by external functions.
Objects may communicate with each other through methods.
New data and methods can be easily added whenever necessary.
Follows bottom-up approach in program design
1.2 Basic Concepts of OOP
Objects: Objects are runtime entities in an object-oriented system. They may represent a person, a
place, a bank account, a table of data or any item that the program may handle.
Classes: The entire set of data and code of an object can be made a user-defined data type using the
concept of a class. A class may be thought of as a “Data type” and an object as a variable of that data
type. Once a class has been defined, we can create any number of objects belonging to that class. Each
object is associated with the data of type class with which they are created.
Data Abstraction: Abstraction refers to the act of representing essential features without including the
background details or explanations. Classes use the concept of abstraction and are defined as a list of
abstract attributes such as size, weight and cost, and methods that operate on these attributes.
Encapsulation: The wrapping up of data and methods into a single unit (called class) is known as
encapsulation. The data is not accessible to the outside world and only those methods, which are
wrapped in the class, can access it. These methods provide the interface between the object’s data and
the program. This insulation of the data from direct access by the program is called data hiding.
Encapsulation makes it possible for objects to be treated like “black boxes”, each performing a specific
task without any concern for internal implementation.
Inheritance: Inheritance is the process by which objects of one class acquire the properties of objects of
another class. In OOP, the concept of inheritance provides the idea of reusability. This means that we
can ass additional features to an existing class without modifying it. this is possible by deriving a new
class from the existing one.