Bloomberg LP Interview Question
Financial Software DevelopersActually, you cannot declare uninitialized reference only OUSIDE the class body.
Inside the class, you can do it, but after you will not be able to create an object of the class, you will get an error
"no default constructor":
class Bugaga1
{
int& i;
};
//Bugaga1 bugug; // if you have an unitialized reference inside the constructor, you cannot create the object (it will say "no default constructor")
//Bugaga1* bugug;
//bugug = new Bugaga();
Three things must be put in the init list:
- Mimi March 02, 20101) Member without default constructor
2) const
3) reference