***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Monday, April 26, 2021

Creating Objects

An object is an instance of a class ( OR ) a class variable is called as object,In other words, a class would be the data type, and an object would be the variable.

The process of creating object of a class is called class instantiation. For a class, the memory is allocated only when that class objects are created.

Creating class variables (objects) is exactly the same as creating variables of the basic data types.

Syntax:-

class_name   object_name;

Example:

Employee   emp;

Note: objects can also be created by placing their name immediately after the closing brace when defining a class.





No comments:

Post a Comment