/// @file main.cpp
/// @author Jens Gruschel
/// @date 2016-07-14
/// Test unterschiedlicher Funktionssignaturen
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::endl;
// Text als Const-Referenz uebergeben
void printA(const string& text)
{
cout << text << endl;
}
// Text als Referenz uebergeben
void printB(string& text)
{
cout << text << endl;
}
// Text als Kopie uebergeben
void printC(string text)
{
cout << text << endl;
}
int main()
{
string text = "warum?";
// Funktionen mit Variable aufrufen
printA(text);
printB(text);
printC(text);
// Funktionen mit Literal aufrufen
printA("warum?");
// printB("warum?"); // geht nicht
printC("warum?");
return 0;
}