View Full Version : can you prototype a class/struct in c++?
Choad
November 30th, 2006, 07:58 AM
basically, i am getting errors and its easy to see why, because in my definition of a struct, i refer to a class that is as-yet undefined. so im thinking i must be able to prototype these things somehow? i googled to no avail...
Zdravko
November 30th, 2006, 08:50 AM
Just write:
class A;
struct B;
//use A and B's names generally
hod139
November 30th, 2006, 10:25 AM
It is called a forward declaration (so now you have some keywords to throw at google).
Tomosaur
November 30th, 2006, 10:40 AM
This is why you go from the ground up :P
But yes, you should just able to declare the class/struct without actually implementing it.
Choad
November 30th, 2006, 06:19 PM
This is why you go from the ground up :P
But yes, you should just able to declare the class/struct without actually implementing it.
yeah but i have cyclic dependencies :p
thanks guys :D
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.