#include <iostream>
using namespace std;
class PtrHolder
{
private:
char *x_;
public:
PtrHolder(char *x): x_(x) {}
void print(){cout<<"Ptr is "<<*x_<<endl;}
};
class RefHolder
{
private:
char &x_;
public:
RefHolder(char &x): x_(x) {}
void print(){cout<<"Ref is "<<x_<<endl;}
};
class ValueHolder
{
private:
char x_;
public:
ValueHolder(char x): x_(x) {}
void print(){cout<<"Value is "<<x_<<endl;}
};
int main() {
char c = 'a';
PtrHolder p(&c);
RefHolder r(c);
ValueHolder v(c);
c = 'b';
p.print();
cout<<"PtrHolder is "<<sizeof(PtrHolder)<<" bytes"<<endl;
r.print();
cout<<"RefHolder is "<<sizeof(RefHolder)<<" bytes"<<endl;
v.print();
cout<<"ValueHolder is "<<sizeof(ValueHolder)<<" bytes"<<endl; return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNsYXNzIFB0ckhvbGRlcgp7Cglwcml2YXRlOgoJY2hhciAqeF87CglwdWJsaWM6CglQdHJIb2xkZXIoY2hhciAqeCk6IHhfKHgpIHt9Cgl2b2lkIHByaW50KCl7Y291dDw8IlB0ciBpcyAiPDwqeF88PGVuZGw7fQp9OwoKY2xhc3MgUmVmSG9sZGVyCnsKCXByaXZhdGU6CgljaGFyICZ4XzsKCXB1YmxpYzoKCVJlZkhvbGRlcihjaGFyICZ4KTogeF8oeCkge30KCXZvaWQgcHJpbnQoKXtjb3V0PDwiUmVmIGlzICI8PHhfPDxlbmRsO30KfTsKCmNsYXNzIFZhbHVlSG9sZGVyCnsKCXByaXZhdGU6CgljaGFyIHhfOwoJcHVibGljOgoJVmFsdWVIb2xkZXIoY2hhciB4KTogeF8oeCkge30KCXZvaWQgcHJpbnQoKXtjb3V0PDwiVmFsdWUgaXMgIjw8eF88PGVuZGw7fQp9OwoKaW50IG1haW4oKSB7CgljaGFyIGMgPSAnYSc7CglQdHJIb2xkZXIgcCgmYyk7CglSZWZIb2xkZXIgcihjKTsKCVZ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