Class and object

how class can be a data type

class is a user-defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class. A C++ class is like a blueprint for an object.

int n;
it means n is a container of type integer(means it holds an integer value)
similarly
node n; // here node is a class
this means n is a container (more specifically object) of type node(it holds an node)

int is predefine data type
whereas node is user define data type

class node{
int a;
}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.