contract CappedToken is MintableToken {
    uint256 public cap;

    function CappedToken(uint256 _cap) public {
        require(_cap > 0);
        cap = _cap;
    }

    /**
     * @dev Function to mint tokens
     * @param _to The address that will receive the minted tokens.
     * @param _tokenId id of the new token
     * @return A boolean that indicates if the operation was successful.
     */
    function mint(address _to, uint256 _tokenId) onlyOwner canMint public {
        require(totalSupply().add(1) <= cap);

        return super.mint(_to, _tokenId);
    }

    function mintWithURI(address _to, uint256 _tokenId, string _uri) onlyOwner canMint public {
        require(totalSupply().add(1) <= cap);

        return super.mintWithURI(_to, _tokenId, _uri);
    }

}
/**
 * @title Capped token
 * @dev Mintable token with a token cap.
 */
function mint(address _to, uint256 _tokenId) onlyOwner canMint public {
        require(totalSupply().add(1) <= cap);

        return super.mint(_to, _tokenId);
    }
/**
 * @dev Function to mint tokens
 * @param _to The address that will receive the minted tokens.
 * @param _tokenId id of the new token
 * @return A boolean that indicates if the operation was successful.
 */