Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing header files #1

Closed
callumgran opened this issue Jan 10, 2023 · 3 comments
Closed

Importing header files #1

callumgran opened this issue Jan 10, 2023 · 3 comments

Comments

@callumgran
Copy link

callumgran commented Jan 10, 2023

Not only the main file, but also the .cpp files should also import their corresponding .hpp file.

@TrymNOHG
Copy link
Owner

TrymNOHG commented Jan 11, 2023

@callumgran Does this apply even when I don't use other methods to build up a method in the .cpp file? For example, if I have a:

int square(int x) {...}
int add_squares(int x, int y) {
return square(x, y);
}

Here, it makes sense since I am using an earlier function and its declaration is placed inside the header file. However, in the functions I created, I never reused any functions, as it wasn't necessary. Is it just good practice to always include the corresponding header?

@callumgran
Copy link
Author

I don't quite comprehend what you mean. Could you be so kind as to show me some images that show your question?

@TrymNOHG
Copy link
Owner

TrymNOHG commented Jan 11, 2023

@callumgran The issue you opened revolves around such an example. Here is the link: https://github.com/TrymNOHG/network-programming/tree/main/Additional%20Work. If you would like me to send pictures as well, I would be more than happy to!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants