Take this scenario:
Contract A {
function whoIsSender() public returns (address){
return (msg.sender);
}
}
Contract B is A {
function withThis() public returns (address){
return (this.whoIsSender());
}
function withoutThis() public returns (address){
return (whoIsSender());
}
}
I was expecting both functions to return the same. Apparently it is not. It seems that using the this
keyword breaks it to a contract-to-contract invocation and then msg.sender
becomes the contract address instead of the wallet? Is this by design and can someone explain why?