C++, how to declare a struct in a header file

后端 未结 7 1500
暖寄归人
暖寄归人 2021-01-30 14:40

I\'ve been trying to include a structure called \"student\" in a student.h file, but I\'m not quite sure how to do it.

My student.h file code c

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 14:55

    Okay so three big things I noticed

    1. You need to include the header file in your class file

    2. Never, EVER place a using directive inside of a header or class, rather do something like std::cout << "say stuff";

    3. Structs are completely defined within a header, structs are essentially classes that default to public

    Hope this helps!

提交回复
热议问题