enter image description here

Hey guys, this is a piece of code from Solidity documentation.

These two interfaces Config and NameReg have never been implemented, how could contract named called it? Do I miss something here?


  • 1
    Welcome! In the future, code snippets are better posted as text instead of an image. Use the {} button in the editor to help with formatting.
    – eth
    Aug 31, 2016 at 2:33

1 Answer 1


The 2 lines of named constructor use addresses. named assumes that the contracts that have already been deployed at those addresses have implemented the interfaces.

config is the contract at 0xd5f9....

config.lookup returns an address so NameReg methods like register can be invoked.

If the contract at 0xd5f9... does not have a lookup method, its fallback function would be invoked. Similar case if the register method doesn't exist on the address returned by config.lookup(1).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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