Created by Kshitij about a year ago
No description provided
why cant just directly assign the value of rollno and name in the function just like you did in the constructor ?
This content was deleted by the author
When we create a structure inside the contract then do we need to specify the memory keyword if we are using string data type in structure?
Last half video was imo unnecessarily complicated. You could have shown different ways of initializing structs in a different function, yet not only you are completely introducing a new way to initialize a struct out of nowhere, you are also instantiating a new struct in memory (instead of just reassigning t.roll and t.name), which is a waste of gas and bad practice. Even when teaching basic concepts, one shouldn't go for bad practices.
The last part was so confusing
solidity has similarities with cpp 😯
If we want to the variables create and accept data from user for more than 1 variable do we need to create more function or we can do in 1 functions itself? For e.g. you created a variable s1 and if want to create s2 also. So to accept the arguments from user for the s2 variable do I need to create a separate function for that?
Kshitij Please explain how we can create an s2 variables and more. It's not possible with constructors as we can only have one. So how do to it with functions?
I am not able to assign the value of roll no and name in the function just like you did in the constructor. It is showing error if we are using constructor method to assign value in the function.
ParserError: Expected a state variable declaration. If you intended this as a fallback function or a function to handle plain ether transactions, use the "fallback" keyword or the "receive" keyword instead.
so struct is a class and rollno and name are objects?