I have a question about include guards. I assume that if you include your header file in multiple source files you should get compilation error, so to prevent the error you need to use
#ifndef
#define SOME_THING_H
...
#endif
I have wrote this code and I included header file in application file and implementation file without using include guards, but it compiles perfectly without any error. I am using Dev C++ 4.9.9.2. Does anybody know if it is always necessary to use include guards? and if not way this code compiles?
Thank you very much I got it.
One more question
If I keep all the member functions like DayOfYear::output() in the header file(DayOfYear.h), do I get linker error if I try to include that file in multiple source files?
If it's in the class body: no (implicit inline)
If it's marked with the inline keword: no (explicit inline)
If it's a template class or a template function: no