I try to understand variable scope in solidity But what that mean in this example new keyword instentiate to a contract Whtat concept use in this logic can someone explain me
pragma solidity ^0.5.0;
contract C {
uint public data = 30;
uint internal iData= 10;
function x() public returns (uint) {
data = 3; // internal access
return data;
}
}
contract Caller {
C c = new C();
function f() public view returns (uint) {
return c.data(); //external access
}
}
contract D is C {
function y() public returns (uint) {
iData = 3; // internal access
return iData;
}
function getResult() public view returns(uint){
uint a = 1; // local variable
uint b = 2;
uint result = a + b;
return storedData; //access the state variable
}
}
I mean this part of code I not understand why they use this example to explain beginner level variable scope I also finding the use of new keyword in solidity ,not found
contract Caller {
C c = new C();
function f() public view returns (uint) {
return c.data(); //external access
}
}
Thanks you