You can define a function without address:
function showSender() public view returns (address)
{
return(msg.sender);
}
AND A SECOND FUNCTION WITH THE SAME NAME with address
function showSender(address passedAddress) public view returns (address)
{
return(passedAddress);
}
They can be at the same time in the same contract without problems or interference. Like this:
contract MyContract {
function showSender() public view returns (address)
{
return(msg.sender);
}
function showSender(address passedAddress) public view returns (address)
{
return(passedAddress);
}
}
When your user is calling MyContract.showSender without arguments he hits the first, in the case ofwith address passed he hits the second.
Remain to understand how to generate such calls with/without address passed, but this is another story... 😉