Notes On OOP
Notes On OOP
Class Object
It is a representation of similar types of It is a unique entity having some
objects. characteristics and behaviours.
Constructor
new operator – This keyword is used to allocate space in dynamic memory for the
storage of data and functions belonging to an object
Class is created by user and so is its data and function. This makes class,
user defined. While creating an object, class becomes the data type of that object,
thus enabling the object to possess its properties (data and function). Thus class
becomes a user defined data type.
The user defined class ‘sum’ becomes the datatype of the object ‘ob’, which acquires
the properties of the class.
Class as OBJECT FACTORY
Class is used to create objects having similar feature. Hence class is referred
to as object factory. Each object of the class possess characteristics (data) and
behaviour (function) defined within the class.
Class is a user defined data type. Class contain data values of various types,
such as String, integer, double etc. Since class is a collection of different primitive
data types, it is known as Composite data type.
When a class is created, the data is merged with the belonging functions.
Objects can communicate with each other only through functions without having
direct interaction with the data members. This shows that class is an abstraction for
the set of its objects.
Since objects are created from class, they are referred to as an instance of a
class. Each object of the class possesses characteristics (data) and behaviour
(function) defined within the class.
_________________________