just a simple question: Is it possible to use a .cpp file in another .cpp file - Like calling for it.
E.g. File1.cpp:
#include < iostream >
#include < string >
using namespace std;
void method(string s);
int main()
{
method("Hello World");
return 0;
}
void method(string s)
{
//get this contents from file2.cpp
}
and File2.cpp:
#include <iostream>
using namespace std;
void method(string s)
{
cout << s << endl;
}
So to be able to do something along the lines of that. So I dont stuff all my code into 1 cpp file
Thanks.
methodinstead of doing it yourself.method(string s)in file1.cpp for this to work. Or have a different name formethod- as the compiler can't tell the two functions apart as it stands.