When using multiple files in C++, for example: main.cpp, definition.cpp, declaration.h
// declaration.h
int Myfunc();
//definition.cpp
#include "declaration.h"
int MyFunc() {return 5;};
// main.cpp
#include <iostream>
#include "declaration.h"
int main()
{
std::cout << Myfunc() << std::endl;
}
Why do I not need to include the definition file into the main file? How can the program know the definition of Myfunc()
when I only have included the declaration?