2

I am a beginner who is currently learning C++. I just had a quick question. If I place an include statement such as, #include <vector> in a header file do I still need to declare the same statement in the source file that implements the header file? My first thought is no because the header file has it included shouldn't the source file, that includes the header, have access to all the include calls that the header has. Sorry if the question is kind of confusing and possibly wrong terminology. Thank you.

3
  • 4
    Technically speaking you don't need to include it again, but as far as coding style is concerned it is better to explicitly list a source file's dependencies. Commented Jun 4, 2014 at 12:25
  • Thank you, I was curious :D . Commented Jun 4, 2014 at 12:28
  • Made it a proper answer :) Commented Jun 4, 2014 at 12:29

1 Answer 1

0

Technically speaking you don't need to include it again, but as far as coding style is concerned it is better to explicitly list a source file's dependencies.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.