3

This question already has an answer here:

Why does warning appear with inheritance of constructor?

contract MyToken is ERC721Token{
function MyToken(string _name, string _symbol) ERC721Token(_name, _symbol) public {
}

The content of the warning is

zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol:38:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. function ERC721Token(string _name, string _symbol) public { ^ (Relevant source part starts here and spans across multiple lines). ,/C/twork/702_Ethereum/ERC-OPZ/myERC721/contracts/MyToken.sol:8:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead. function MyToken(string _name, string _symbol) ERC721Token(_name, _symbol) public { ^ (Relevant source part starts here and spans across multiple lines).

I am using truffle v4.1.7 solidity v0.4.23

Thanking you in advance

marked as duplicate by Ismael, Achala Dissanayake, Richard Horrocks, flygoing, Community May 2 '18 at 2:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6

Since the version 0.4.22 of Solidity, you don't define the constructor as the function with the same name than the contract, you have to use function constructor(myparams....) {...} from now on.

Read more here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.