I guess you mean, how do I call a function (not method) that's defined later in the same file (not class). You're not defining any classes here, so there's no need to worry about constructors. (Perhaps you're used to languages that force you to wrap all the code up in classes. Welcome to C++: there's none of that nonsense here.)
You need to declare a function before you call it, so either do that:
void disMessage(string); // declaration
int main() {
disMessage("safas"); // use (after declaration)
return 0;
}
void disMessage(string a){ // definition
cout << "\n" << a << endl;
}
or move the function definition to before the point of use: a definition is also declaration.
void disMessage(string a){ // definition and declaration
cout << "\n" << a << endl;
}
int main() {
disMessage("safas"); // use (after declaration)
return 0;
}