I can't seem to figure out the correct syntax for using non-primitive data-types in header files. Can someone please help?
Here's an example of an attempt that won't compile:
The #include directive may not belong there, but what triggers the error is just using the string variable in defining my structure. It just seems to me that there has to be a way to use non-primitive data-types in your header files, but I'm not getting it right, obviously.Code:#include <string> struct golf { string fullname; int handicap; }; void setgolf(golf & g, const string name, int hc); int setgolf(golf & g); void handicap(golf & g, int hc); void showgolf(const golf & g);
Just as point of info, this goes with ch. 9, ex. 2 in Prata, C++ Primer Plus.