navi Messages: 107 Registered: February 2012 Location: Sydney, Australia
Experienced Member
the object t1 is within the class scope of H1. and it is a private member so access is restricted only within the class. if data need to be set from outside the class you have to implement a interface for that. usually through a public function like
void Set_t1(int a){ t1<=a; }
option two is to make the global function AddNum2() to return the result as string and set the return value of the function to t1 in H1() contractor. see the example in the attachment.
its nothing to do with U++. you need to read up on C++ scope of variables and specially class scope.