I am trying replicate the program given at the following link: What is a function Selector
However, I am not using the function selector. I am using the name of the function explicitly to invoke it by associating it with contract'ss address and calldata syntax. I have two problems first I can't understand how to retrieve the arguments returned by the called function. Secondly I am getting the syntax error:
solc calwoFSelector.sol calwoFSelector.sol:12:25: Error: Member "func" not found or not visible after argument-dependent lookup in address. bool success =dest.func.value()(uint256(789), uint8(123));
^-------^
My complete code is:
pragma solidity ^0.5.1;
contract Contract1 {
function func(uint256 x, uint8 y) public returns (uint32, uint32) {}
}
contract Contract2 {
Contract1 public contract1 = new Contract1();
function func() public returns (uint32, uint32) {
uint32[2] memory ret;
address dest = address(contract1);
bool success =dest.func.value()(uint256(789), uint8(123));
return (ret[0], ret[1]);
}
}