This is pass by value:
Code:
#include <iostream>
#include <string>
using namespace std;
void SomeFunction(string** pointerToStringPointer)
{
**pointerToStringPointer = "Goodbye world!";
}
int main()
{
string helloString = "Hello world!";
string* pointerToHelloString = &helloString;
string** pointerToHelloStringPointer = &pointerToHelloString;
SomeFunction(pointerToHelloStringPointer);
cout << helloString;
};
This is pass by reference to do the same thing:
Code:
#include <iostream>
#include <string>
using namespace std;
void SomeFunction(string*& referenceToStringPointer)
{
*referenceToStringPointer = "Goodbye world!";
}
int main()
{
string helloString = "Hello world!";
string* pointerToHelloString = &helloString;
string** pointerToHelloStringPointer = &pointerToHelloString;
SomeFunction(*pointerToHelloStringPointer);
cout << helloString;
};
Your friends are right.