Chapter 2
Chapter 2
Declaration of class:
class class_Name
{
//data mambers
// Member Methods
}
Object:
Objects are the instance of a class. When an object is created, it
acquires memory space in the computer. It is created and eventually
destroyed – so they only live in the program for a limited time. There
can be more than one instance of an object. Each instance of an object
can hold its own relevant data.
The different components of an object are:
• characteristics or attributes or state
• Behaviour or methods
• Name of the object or identity
Creating object of a class: