Classes / Methods

#include <iostream>
using namespace std;

class Message {
public:
    string text;

    void show() const {
        cout << text;
    }

    void setText(string value) {
        text = value;
    }
};

const Message message {"hello"};
//message.setText("goodby"); //<-Error
message.show();