mardi 3 mars 2015

Declaring references works in a class but not in main function


class Test{
int &b; // no error, can compile
};


int main() {
int &b; // error: 'b' declared as reference but not initialized
}


Why I cant have int &b in main function, but can have it in Test class?


Aucun commentaire:

Enregistrer un commentaire