We made Myclass.h and saved it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

We made Myclass.h and saved it

by using "#include"Myclass.h" are we invoking it ????? in other programs

30th Apr 2017, 8:44 AM
Dgionbxeeruonb Hkkvnjf
Dgionbxeeruonb Hkkvnjf - avatar
13 Answers
0
Put your Myclass.h file in the same folder as your currentfile.cpp .Now everytime your program runs your compiler fetches the code of Myclass.h and inserts into your program similar to a macro substitution.
30th Apr 2017, 8:52 AM
Nantha
Nantha - avatar
+ 1
Correct u got my point.Provided that location is the default folder for storing header files
30th Apr 2017, 9:03 AM
Nantha
Nantha - avatar
0
You are just adding the lines of code in Myclass.h onto your current file. Contents of Myclass.h is retrieved by the compiler and placed for processing.
30th Apr 2017, 8:47 AM
Nantha
Nantha - avatar
0
Don't know hindi bro.English could be a better option.
30th Apr 2017, 8:48 AM
Nantha
Nantha - avatar
0
okay does it mean we can use myclass CPP file in any future programs ??? codeblock (or ur compiler ) would find the file from disc each time we invoke it in a program
30th Apr 2017, 8:50 AM
Dgionbxeeruonb Hkkvnjf
Dgionbxeeruonb Hkkvnjf - avatar
0
oooooooo😌😌😌 I see thanks bro ...I was confused what type of header file it was
30th Apr 2017, 8:54 AM
Dgionbxeeruonb Hkkvnjf
Dgionbxeeruonb Hkkvnjf - avatar
0
Note if you have your Myclass.h and iostream.h on the same folder use include<my class.h> else if currentfile.cpp and Myclass.h lies in the same folder as I told earlier use include"my class.h"
30th Apr 2017, 8:54 AM
Nantha
Nantha - avatar
0
bro can u tell me reason behind it ?
30th Apr 2017, 8:55 AM
Dgionbxeeruonb Hkkvnjf
Dgionbxeeruonb Hkkvnjf - avatar
0
for what use of "" or <> ????
30th Apr 2017, 8:57 AM
Nantha
Nantha - avatar
0
yes why r using ""sometimes and <> other times
30th Apr 2017, 8:57 AM
Dgionbxeeruonb Hkkvnjf
Dgionbxeeruonb Hkkvnjf - avatar
0
<> the complier looks for the file on the default directory i.e folder for storing header files. "" the compiler looks for the file on the storage location of the currentfile.cpp.It can even be your desktop .
30th Apr 2017, 9:00 AM
Nantha
Nantha - avatar
0
and if currenfile.CPP, iostrem.h and my class.h are in same folder than we can use <> ??
30th Apr 2017, 9:02 AM
Dgionbxeeruonb Hkkvnjf
Dgionbxeeruonb Hkkvnjf - avatar
0
oh thanks bro ,thank you very much .👍
30th Apr 2017, 9:05 AM
Dgionbxeeruonb Hkkvnjf
Dgionbxeeruonb Hkkvnjf - avatar