172k views
2 votes
What does it mean to 'instantiate' an object?

1 Answer

1 vote

Explanation:

Instantiate an object means creating an instance of accessing the property of a class we can create instance or object for that class. The property of class means method and variable with the help of instance we can directly access the method and variable.

For example

class abc // class abc

{

public:

void sum1() // function definition

{

cout<<" hello "; // display hello

}

};

void main() // main method

{

abc ob; // creating an instance

ob.sum1(); // calling a function sum1

}

Output:

hello

Here we create a instance of class abc i.e ob which can access the method sum1().

User Gin Quin
by
5.1k points