When working with say, the standard strings class in c++.
Do you need to have #include<string>
on both the header and source file?
can you not just have #include<string>
only on the header file?
Including on the header file may indicate a dependency at the class definition level (for example you are accepting or returning Strings). In this case you have to put the include in the header; however if you are only using Strings in your implementation you may need to include only on the source file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With