I'm attempting to use a class inside a struct, which seems to be no problem if I declare the class first:
class Foo {
}
stuct Bar {
Foo example[5]; // array of Foos
}
This seems fragile. It should work in whatever order like functions use prototypes for. I tried prototyping them, but this doesn't work.
class Foo;
struct Bar;
stuct Bar {
Foo example[5];
}
class Foo {
}
Why doesn't this work? Error code C2079 (on visual studio): 'Bar::Foo' uses undefined class 'Foo'. Error code C2148: total size of array must not exceed 0x7fffffff bytes. Both on the errors occur on Foo example[5];
Also, would it be appropriate to keep my function prototypes above the ADTs (abstract data types) so I can use the functions inside them, or should I write the function inside the ADT?