msg.sender 消息的发送者,对应当前交易里面的from
pragma solidity ^0.4.6;
contract TestMsg{
address public _owner;
uint public _number;
function TestMsg(){
_owner = msg.sender;
_number = 100;
}
function msgSenderAddress() constant returns(address){
return msg.sender;
}
function setNumberAdd5(){
_number = _number + 5;
}
function setNumberAddByOwner(){
if(_owner == msg.sender){
_number = _number + 10;
}
}
}