Code 1
class Drink
{
public:
Drink( char *name_ ) : name( name_ ) {}
char *name;
char get(int i) const { return name[i]; }
};
Code 2
class Drink
{
public:
Drink( char *name_ ) : name( name_ ) {}
char *name;
char & get(int i) const { return name[i]; }
};
Why the second code is better