I am still a beginner in C++, and I am supposed to find the errors in the following code.
1 class Thing
2 {
3 public:
4 char c;
5 int *p;
6 float& f;
7 Thing(char ch, float x) { c = ch; p = &x; f = x; }
9 };
I understand that in the sixth line there is an error: reference f need to be initialized. But I am confused about the seventh line. It looks like a constructor, but I cannot make sure p = &x; is correct? Also, If I want to correct the error of the reference initialization, how can I do it?