Header Guards

Uuuuhhh so, am I supposed to put header guards in just the .h file or in both the .h file and the .cpp file?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

———————————————————————
cls.h file
———————————————————————

#ifndef CLS_H
#define CLS_H

class cls {
  public:
  cls();
};

#endif


———————————————————————
cls.cpp file
———————————————————————

#ifndef CLS_CPP
#define CLS_CPP
#include "cls.h"

cls::cls() {
  int x = 33;
}

#endif 
Just the header. The implementation file would presumably #include the header.
But yeah please read keskiverto's link.
Last edited on
Cool ok thanks guys!
Topic archived. No new replies allowed.