0

Why are interfaces restricted to enums, events, structs and functions?
Why are they restricted from containing state variable declarations if they can contain structs?

  • 1
    There's a difference between "a struct" and "an instance of a struct". The idea in an interface (which BTW, is general to all programming languages and not just Solidity) is that it consists of a "hollow facade", i.e., it only declares the functionality which will be exposed by anyone who implements it. Actual code and data (state-variables in your case) are both outside of this scope. – goodvibration Jul 26 at 15:16
  • thanks for the answer – NowsyMe Jul 26 at 15:21

Your Answer

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

Browse other questions tagged or ask your own question.