using namespace std;
int a = 20;
// You can't modify value of "a"
x = 10;
When you write "throw a", an invisible, phantom exception object gets created. You pass reference to that object and hence any change made to original object have no effect.