0

Is it possible to make a C++ project without our custom header files? suppose i write a class, what about not including ...h?

hearder file so mandatory?

5th Mar 2018, 12:16 PM
Romesh Khun
Romesh Khun - avatar
2 Antworten
0
It's actually necessary to include a header file when dealing with classes in separate files. A header file contains the constructor's definition which links to the class itself. Without it, the compiler wouldn't know where to find the class if you used it, and would return a compiler error. If you did write the class and the main program itself in the same file, which is impractical by the way if you are using several, that's the only time header files won't be needed.
5th Mar 2018, 1:06 PM
apex137
apex137 - avatar
0
thanks nik1082
10th Mar 2018, 2:33 PM
Romesh Khun
Romesh Khun - avatar