How to create a user-defined header file? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

How to create a user-defined header file?

is that possible to create a user-defined header file? i mean if i wanna make a user-defined function for addition of two no. s and wants that it should stored in a header file made by me. so is it possible ? if yes then how?

12th Aug 2017, 6:09 AM
Akash Pandey
1 ответ
+ 9
Write your header file which includes your classes, functions, etc. Rename the file to .h extension. In your main.cpp, include the header file. #include "myheader.h" You may also want to look at the preprocessor directives which you may need to include in the header file. https://stackoverflow.com/questions/3246803/why-use-ifndef-class-h-and-define-class-h-in-h-file-but-not-in-cpp
12th Aug 2017, 6:13 AM
Hatsy Rei
Hatsy Rei - avatar