+ 1

Headers

why does included headers in c++ has functionally.. while headers are meant to be for definition only .. and no implementation! ?

9th Aug 2018, 5:23 PM
Ahmed Mamdouh
Ahmed Mamdouh - avatar
6 Respostas
+ 3
headers are meant to declare functions or variable... their implementation is to be done in cpp files... once you need to use those function in other unit, you need to include headers in other unit... this header inclusion will allow you to use those functions declared in header nd defined in cpp..
9th Aug 2018, 5:26 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 2
include means simply copy paste of data from one unit to another unit.. this is precompile task... as "include" is a preprocessor... precompile does inclusion, removal of code comments and macro definition inclusion before actual compilation by compiler.. using means allowing from one unit to other unit without direct copy paste... this inclusion is handled by compiler, not preprocessor...
9th Aug 2018, 5:37 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
9th Aug 2018, 5:41 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
When you define a header, you have access to every available function and usable feature of the module. Defining a header defines access to the contents within it.
9th Aug 2018, 5:25 PM
Dread
Dread - avatar
0
OooK .. what is the difference between include and using in c++ then ? thanx
9th Aug 2018, 5:27 PM
Ahmed Mamdouh
Ahmed Mamdouh - avatar
0
last question .. is there a preprocessor language or some source to learn it .. how did u learn it ? it's not included in c++ .. thanx alot
9th Aug 2018, 5:40 PM
Ahmed Mamdouh
Ahmed Mamdouh - avatar