This might be your source of error.
class2(int i)
{
class1 objxx(99);
obj1 = objxx;//constructing object 1
obj1.variab += i;
cout << obj1.variab;//using obj1
}
This will actually assign your obj1 variable within class2. Before it was just making a temp variable during your constructor runtime.