I have the following code:
#include<iostream>
using namespace std;
class Vec{
private:
int& var;
public:
Vec(int& tmp){
var = tmp;
}
};
int main(){
int x = 10;
Vec v1(x);
}
but it gives a compilation error:error: uninitialized reference member in ‘int&’ [-fpermissive]
How to resolve this?