0

Hey,

So, my understanding of header files so far are that they're basically code that can be used by multiple .cpp files.

But if you have a prototype in a file.h that's declared in a file.cpp that includes file.h, and then FILE.cpp includes file.h, does FILE.cpp have access to the function defined in file.cpp?

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

yes. That function can also be called by any *.cpp function that includes file.h. You find this all the time, such as standard header files supplied by your compiler.

// file.h
int foo(); // function prototype
// file.spp
int main()
{
    foo();
    return 0;
}

int foo()
{
    return 0;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.