Best practice for including from include files

后端 未结 6 1193
谎友^
谎友^ 2021-01-21 02:05

I was wondering if there is some pro and contra having include statements directly in the include files as opposed to have them in the source file.

Personally I like to

6条回答
  •  野性不改
    2021-01-21 02:25

    There's not really any standard best-practice, but for most accounts, you should include what you really need in the header, and forward-declare what you can.

    If an implementation file needs something not required by the header explicitly, then that implementation file should include it itself.

提交回复
热议问题