In Solidity, is it possible to change states via function calls in other contracts?
For example, let's consider the code below, where we have three assumptions:
- The function
test2
is defined in the contractC2
. - The contract object
c2
of the typeC2
is created at somewhere withinC1
. - We deployed
C1
as a root contract.
Then, is it possible for the function call statement c2.test2()
to change the values of variables in C1
(e.g., x1, x2, x3, etc)?
Contract C1 {
uint x1;
uint x2;
uint x3;
...
function test1 () public{
/* can c2.test2() change the values of variables */
/* within C1? (e.g., x1,x2,x3, etc) */
c2.test2 ();
}
}