From what I have been seeing from C++
code examples, if I have two files Log.cpp
and Math.cpp
in Math.cpp
we have,
#include <iostream>
void Log(const char* message);
static int multiply(int a, int b){
Log("Multiply");
return a * b;
}
in Log.cpp
we simply print the text that was given to us. However unlike most programming languages that I use we do not directly import the method from a specific module or file, we simply declare it in C++
. For example in Python it would be from x import y
, which meant that we could have multiple definitions of y
but depending from where we imported it from, depended in which implementation was used. How would this works in C++
if I had multiple definitions of Log
, how would it know which one to use?