-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
constructor, internal, and why not external? #3132
Comments
See #2638. Basically it allows an abstract contract to have a constructor, which is used by the child. |
Thanks, that's helpful and makes sense. Any explanation for:
Idea-wise, if a constructor was allowed to be |
Hm, I cannot recall any particular reason, but yes, inheritance would be a problem with external constructors. |
@ethers would you be interested in documenting the above in the main docs? This question comes up a few times, good have it explained. |
@elenadimitrova yes, please take it, it would be great having this document. @ethers has not expressed interest, it is safe to assume he hasn't started working on it. |
Is this the best place in the documentation for that @axic Shall we roll in #627 here as well? |
@elenadimitrova I think it would make sense introducing a new section for constructors somewhere in the Inheritance section. |
@elenadimitrova Thanks for documenting the reason for internal constructors. |
Remix tells me:
Constructor must be public or internal
If i make
internal
I get:This contract does not implement all functions and thus cannot be created.
...What's the purpose and how to use an
internal
constructor ?Why must a constructor be
public
instead ofexternal
?The text was updated successfully, but these errors were encountered: