0% found this document useful (0 votes)
51 views3 pages

Chapter 2 Elementary Concept of Objects and Classes Theory

The document explains the fundamental concepts of objects and classes in object-oriented programming. An object is a unique entity that contains data and functions, while a class serves as a blueprint for creating objects with shared characteristics and behaviors. It also highlights the distinction between real-world objects and software objects, and provides examples and syntax for creating objects from classes.

Uploaded by

Agam Stories
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)
51 views3 pages

Chapter 2 Elementary Concept of Objects and Classes Theory

The document explains the fundamental concepts of objects and classes in object-oriented programming. An object is a unique entity that contains data and functions, while a class serves as a blueprint for creating objects with shared characteristics and behaviors. It also highlights the distinction between real-world objects and software objects, and provides examples and syntax for creating objects from classes.

Uploaded by

Agam Stories
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/ 3

ELEMENTARY CONCEPT OF OBJECTS AND CLASSES

Object:- Object is a unique entity, which contains data and functions


(characteristics and behaviours) together in an object oriented
programming Language.
Class: - Class is a template of objects. Each object of a class possessed
some attributes and common behaviours defined with in the class.
Thus, class is also referred to as a blue print or porotype of an object.
Real World Object: - The object that we experience or use in our day
to day life. Each real-world object contains characteristics and
behaviour. The characteristics basically comprises the parts of its
body or specifications whereas behaviours as the purpose of its use
or its functions.
Software Object: - A software object may be defined as an object that
is created while writing a java program. When we compare a software
object with the real-world object then the characteristics are referred
to as data members of software objects whereas behaviours of real-
world objects are compared with member methods (functions) of
software object.
Creating objects of a class: - Syntax of creating an Object of a class:
<class name> <object name> = new <class name>();
Object is also called the instance of the class. When an object of a class
is created then it is said to be instantiation.

Page | 1
UMESH COMPUTER KENDRA (PH : 9897188951)
Example of Real World Class and Objects:- Let us take and example of
class ‘Car’. The characteristics of class car are its colour, model, price,
fuel_capacity, engine_capacity etc and behaviours of car it can
accelerate, halt etc. Objects of class ‘Car’ can be Alto, I10, I20, Honda
City, Honda Brio, Nano, Creta etc.
The various objects of class ‘Car’ can be created by using the following
statements:
Car nano=new Car();
Car creta=new Car();
Car alto=new Car();
Here ‘new’ is the keyword which is used to allocate memory for the
storage of data and functions belong to an object.

Class as an obect factory:- A class has the complete description of the


member variables and functions the object will contain. A class can
create number of objects with same characteristics and common
behaviour just like a factory can produce similar items based on a
particular design. Hence, class is also referred to as 'Object Factory'.

Class is a user defined data type: - The class name becomes the data
type for the instances used in the program. It is such a data type that
includes various predefined data types within it. Hence, the class is
said to be a composite data type.

Object is an instance of a class:- A class can create objects of itself


with same characteristics and common behaviour. An object
possesses instant variables and methods defined within the class.
Hence, an Object is called an Instance of a Class.

Page | 2
UMESH COMPUTER KENDRA (PH : 9897188951)
Differences between Object and Class :-

Class Object
It is a unique entity having
It is a template that describe the some characteristics and
details of an object. behaviours, define inside the
class.
It is an object producer and
It is created with the use of the
hence called a blue print for a
‘new’ operator.
set of objects.
It is known as an ‘Instance of a
It is known as an object factory.
Class’

Page | 3
UMESH COMPUTER KENDRA (PH : 9897188951)

You might also like