reincluding header in implementation

后端 未结 3 1923
遇见更好的自我
遇见更好的自我 2021-01-05 11:16

suppose I have a header foo.h like this:

#ifndef FOO_H
#define FOO_H
#include 
#include \"non_standard_class.h\"

std::string foo(         


        
3条回答
  •  灰色年华
    2021-01-05 11:27

    I would say it is, because otherwise your foo.cpp is relying on a detail of foo.h that may change. Obviously this is more of a problem with other .h files that aren't under your control, but I still do it for consistency sake.

提交回复
热议问题