This is a practice that we did in our robotics club a while ago. We were supposed to create to classes, one that would assign user input to a variable (cin) and another one that would print it out (cout). We needed to use pointers to acheive this, and this is what I came up with.
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class Input
{
public:
    string* textString = new string();
    Input(string uInput)
    {
        textString = &uInput;
    }
    void userInput() {
        cout << "Enter some text - ";
        cin >> *textString;
    }
private:
    // Nothing yet
};
class Output
{
public:
    string* inputText = new string();
    Output(string uInput)
    {
        inputText = &uInput;
    }
    void userOutput() {
        cout << *inputText << endl;
    }
private:
    // Nothing yet
};
int main()
{
    string userInput = "EMPTY";
    cout << &userInput << endl;
    Input i = Input(userInput);
    i.userInput();
    Output o = Output(userInput);
    o.userOutput();
    return 0;
}
However, it doesn't seem to work. When I run this in Visual Studio 2018, and enter a value, it waits a couple of seconds and prints "Press any key to continue..." and ends the program. Nothing appears in the compiler either. Could somebody with more C++ knowledge help me understand what is wrong with my code? Thanks!
 
    