from what I understood, any state variables that are not private can be called and modified by any contract that inherets the parent contract.
it usually takes more than one contract to develope a DApp. so you eventualy need to make several contracts and may use state variables of other contracts. Or even if you don't, some one can copy your code and inherets it and modify(delete/update some data from them) your state variables.
making the sate variables private is like erasing the question. because you will lose the access to your state variables in other contracts you need.
there is a thing in solidity that if you make a state variable public. the solidity automatically creates a getter/ view fucntion for that variable callable by all users.
so how do you protect it from getting modified by other contracts/attackers?
I know that modifying them costs money but still , is there a safe way to prtect non-private state variables from getting attacked?
see the code below:
contract Reputation{
uint[] points; // internal, or public
}
contract Market is Reputaion{
functio foo() public{
points[0]= 1;
delete points[1];
}
}
Imagine if the Market contract is made by attacker to modify your data!