Declaration of class objects
1.
Single object declaration
Syntax:
Classname objectname;
Example :
Student s;
s |
roll name age |
2.
Multiple object declaration
syntax:
Classname objectname1, objectname2,objectname3;
Example:
Student s1,s2,s3;
s1 | s2 | s3 |
roll name age |
roll name age |
roll name age |
3.
Array type object declaration
syntax:
Classname objectname[size];
Example:
Student s[8];
s[0] | s[1] | s[2] | s[3] | s[4] | s[5] | s[6] | s[7] |
roll name age |
roll name age |
roll name age |
roll name age |
roll name age |
roll name age |
roll name age |
roll name age |