Google News
logo
CPP - Interview Questions
What is an Object in C++?
An object is a run-time entity. An object is the instance of the class. An object can represent a person, place or any other item. An object can operate on both data members and member functions. The class does not occupy any memory space. When an object is created using a new keyword, then space is allocated for the variable in a heap, and the starting address is stored in the stack memory. When an object is created without a new keyword, then space is not allocated in the heap memory, and the object contains the null value in the stack.
class Student  
{  
//data members;  
//Member functions  
}  

 

The syntax for declaring the object :
Student s = new Student();  
Advertisement