Wednesday, November 15, 2023

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.





0 comments:

Post a Comment

Data Structures with C++



NET/SET/CS PG



Operating Systems



Computer Networks



JAVA



Design and Analysis of Algorithms



Programming in C++

Top