enigmatrix
Programmer
I want to use reference variable as a datamember in a c++ class,but during the compilation it is showing an
error: "refence member requires an initializer.."
Program i wrote is:
#include <iostream.h>
extern int pub;
class ex
{
int &data;
public:
ex()
{
data=:ub;
}
};
int pub=200;
void main()
{
ex a;
}
****
Anybody body knows technique to use a reference as datamember.
****
error: "refence member requires an initializer.."
Program i wrote is:
#include <iostream.h>
extern int pub;
class ex
{
int &data;
public:
ex()
{
data=:ub;
}
};
int pub=200;
void main()
{
ex a;
}
****
Anybody body knows technique to use a reference as datamember.
****