+ 1
What does #include MyClass.h means?
3 ответов
+ 6
first of all, you can't apply #include MyClass.h.
you need to change it like : #include "MyClass.h"
It means, you created a new class(or file) for your project and you want to add it to your current source code.
Its adventages are:
-Simplication: Your code seems simple, readable and extendable.
-Clarification: If you seperate your classes, templates, namespaces, etc., you can have more control over your code and it gives you better debug and test.
Its disadvantaces are:
-More complex build for beginners.
-Ridiculous for simple programs like Basic I/O programmes, Single Class Projects, etc.
-Sometimes (for likely to beginners) gives header problems like header duplication and "header won't find" problems
For conclusion, be careful when you use header separation.
0
好评
0
# tells that the statment following it is a preprocessor. If MyClass.h exists and included with correct syntax, whole code of the file MyClass.h is copied into the program.
#include "MyClass.h"