object is the 'instance of the class'.
object contains all the details of the class.
object allocates memory to the class non-static variables.
object has physical reality,i.e., an object occupies physical space in memory.
syntax:
1. class_name object_name;
2. class_name=new class_name();//class_name() is made a call to its class default constructor.
In C++ 1.will create instance for a class, 2. allocates memory statically i.e., at run time in. In JAVA 1. will be reference and the 2. will be instance for a class.
Example:
Student S=new Student();
No comments:
Post a Comment