Re: System-header, header-file, using and ::
From: Ulrich Eckhardt (doomster_at_knuut.de)
Date: 06/26/04
- Next message: Ronen Kfir: "Re: array lines shifting"
- Previous message: George Huber: "Re: C++ and graphics."
- In reply to: Edo: "System-header, header-file, using and ::"
- Next in thread: Nils Petter Vaskinn: "Re: System-header, header-file, using and ::"
- Reply: Nils Petter Vaskinn: "Re: System-header, header-file, using and ::"
- Reply: George Huber: "Re: System-header, header-file, using and ::"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 26 Jun 2004 09:27:27 +0200
Edo wrote:
> Ok, it needs to be explained to me again. Even after reading I am trying
> to do what if, so whats the safe practice with the least redundancy.
>
> #ifndef GUARD_grade_h
> #define GUARD_grade_h
> //grade.h
> #include <iostream>
> #include <vector>
>
> // no using here. Only std::
> fun prototype
> #endif
>
> ///////////////////////////////////////////////////
> //grade.cpp needs iostream and vector to run
> #include grade.h
> // since grade.h has the system headers iostream and vector
> // I don’t need to include them here too, right???
Yes. The first stage when compiling is that the preprocessor scans the
given file(usually that would be grade.cpp here) and replaces all #include
statements with the content of the file being included.
> //some_other.cpp needs iostream and vector to run
> if I
> #include grade.h which needs to be in here any way then
> I don’t need to include system headers iostream and vector?
Again, the same method is applied. The fact that grade.cpp and grade.h have
the same name(except extension) is irrelevant to the compiler, it treats
some_other.cpp jush the same.
Uli
-- FAQ: http://ma.rtij.nl/acllc-c++.FAQ.html
- Next message: Ronen Kfir: "Re: array lines shifting"
- Previous message: George Huber: "Re: C++ and graphics."
- In reply to: Edo: "System-header, header-file, using and ::"
- Next in thread: Nils Petter Vaskinn: "Re: System-header, header-file, using and ::"
- Reply: Nils Petter Vaskinn: "Re: System-header, header-file, using and ::"
- Reply: George Huber: "Re: System-header, header-file, using and ::"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|