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

前端 未结 3 608
心在旅途
心在旅途 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:09

    It changes nothing. It's just a convention whether you use a *.h or *.cpp or *.asdasd suffix, as long as it doesn't get compiled by itself.

    Some projects use the .hxx extension for header files and .cc for source file.

    Please, for the good of fellow programmers you'll work with, stick to common conventions and don't put header code in .cpp files.

提交回复
热议问题