Replies: 2 comments 3 replies
-
Other way around. The variable name is SimpleStorage simpleStorage = new SimpleStorage(); With this line, we are saying: "Let's create a |
Beta Was this translation helpful? Give feedback.
-
Patrick's answer is 100% correct, so my comment is just an additional observation. I've always thought it looks strange (and redundant) to declare variables this way:
...because shouldn't the compiler know what type the variable will be on the left side from the type of the class on the right side? And in fact, many languages will infer the variable type on the left from the class type on the right, like this:
But some languages force you to remove any possible ambiguity and be explicit in your declaration. Consider the following code, where you have one contract inheriting from another:
Even though there are three instantiations of Apparently, Solidity used to allow the |
Beta Was this translation helpful? Give feedback.
-
Can some please explain this to me?
SimpleStorage simpleStorage = new SimpleStorage();
I understand the second part, but I don't understand why "SimpleStorage" is of type "simplestorage"
Thanks Team,
Beta Was this translation helpful? Give feedback.
All reactions