Difference in including the .cpp file and .h file (with the same content in cpp)?

前端 未结 3 574
心在旅途
心在旅途 2021-01-20 01:58

I\'ve recently started learning cpp from basics and was very much confused with the folowing:

Lets say I have a header( test.h which contains only decla

3条回答
  •  孤街浪徒
    2021-01-20 02:10

    #include just does a copy-n-paste of the file you include into the current file. What the file is named doesn't matter one bit - you can name it "foo.exe" if you like; as long as it contains valid source-code in the context where it is included all is well (but please don't use unconventional names, you'll just confuse people).

提交回复
热议问题