
#include <iostream>
#include <string>

using namespace std;

struct cache {
    bool valid;
    string rep;
};

class Date {
public:
    Date(int dd, int mm, int yy) : d{dd}, m{mm}, y{yy}, c{new cache{false, ""}} {};
    ~Date() { delete c; }
    string string_rep() const;
private:
    int d,  m, y;
    cache * c;
    void compute_cache_value() const;
};

string Date::string_rep() const {
    if (!c->valid) {
        compute_cache_value();
        c->valid = true;
    }
    return c->rep;
}

void Date::compute_cache_value() const {
    c->rep = "Hello";
}

int main() {
    Date const d(1, 1, 1970);
    cout << d.string_rep();
    return 0;
}