Hey guys, I was just wondering why when dealing with a lot of classes do you often have to use something like the following code before the class:

#ifndef classCarhpp
#define classCarhpp

and this code after the class


Thanks in advance.

That is called an inclusion guard. You put one in each header file you write. Its purpose is to stop the header file being included twice inadvertantly.


It's amazing what your brain reads/thinks when you see a word that looks like another word...