According to Wikipedia:
(by default access to members of a class is private). The private members are not accessible outside the class; they can be accessed only through methods of the class. The public members form an interface to the class and are accessible outside the class.
And tutorialspoint:
By default all the members of a class would be private, for example in the following class width is a private member, which means until you label a member, it will be assumed a private member
Meaning that if you want to access a data member outside the class, you need to set its access modifier to public.
class object{
public:
object* Next;
};
Or, alternatively, you could make a getter
class object{
object* Next;
public:
object* getNext() {
return Next;
}
};
And then, to access it:
c->getNext();
Edit: I just realized that the error you got was not for calling a private member. So you can probably disregard this for that error. That said, you still might want to be watch out for this, unless you didn't post the full code and know that already.