Kotlin, I dont understand why you must attached the "type" when you use "this" keyword
Go to solution
Solved by jj9987,
5 hours ago, JoneLoveIT said:but why function print in the screenshoot have no return type?
Because print function does not return anything, it only triggers a print output to standard output.
4 hours ago, JoneLoveIT said:and why do you still need : Order when it already in Order class?
Doesn't matter where the function is or what it belongs to. It still must define what it returns. A function in Order class can also return just a string. For example, you can have a function in the Order class, that is named getItems() and returns itemList, that is of type MutableList<Item>.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now