Classes and Objects with Constructors/Destructors: Creating Objects

Get unlimited access to the best preparation resource for UGC : Get detailed illustrated notes covering entire syllabus: point-by-point for high retention.

Download PDF of This Page (Size: 175K)

Image of Create object

Image of Create Object

Example 1

Chart2.txt

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: