A Simple Example:
void foo(class Bar * bar) {
foo2(bar);
}
void foo2(Bar * bar) {
bar->a++;
}
The Pointer used in foo2 is a standard Pointer to the class Bar. OK - The Pointer used in foo is also a pointer to the class Bar. But the class Bar must not be known at this place.
I can't find the correct naming for the argument of foo. It is a pointer to an anonymous class? What is the correct name for the class Bar *bar
?
What you need is forward declaration
.
You can read about it in the documentation or in a different post.
From the documentation:
Declares a class type which will be defined later in this scope. Until the definition appears, this class name has incomplete type. This allows classes that refer to each other.