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

#endif

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.

Thanks guys. :)

Idempotence

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.