Classes and Objects with Constructors/Destructors: Creating Objects

Get unlimited access to the best preparation resource for UGC : Get complete video lectures from top expert with unlimited validity: cover entire syllabus, expected topics, in full detail- anytime and anywhere & ask your doubts to top experts.

Download PDF of This Page (Size: 176K)

Image of Create object

Image of Create Object

Image of Create object

Example 1

Chart2.txt

Image of class and object

Image of Class and Object

Image of class and object

Creating Objects

  • An object is an instance of a class and it can be created by using class name. student st; Object can be created.

  • When a class is defined by placing their names immediately after the closing brace.

Chart3.txt

The above definition would create the object x, y and z of type student.

Developed by: