Single class has a Class Redefinition Error

后端 未结 4 1101
眼角桃花
眼角桃花 2021-01-04 19:00

I\'m new to C++, and I\'m having a problem with my class definitions in a header file. The code for the header file (Student.h) is:

#include 
u         


        
4条回答
  •  攒了一身酷
    2021-01-04 19:30

    I prefer using

       #pragma once
    

    as the first line of a header file, instead of the defines. Even if this is non-standard, it does avoid name clashes and can reduce compile time.

提交回复
热议问题