This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Answer the following questions to demonstrate what you've learned:
Function parameters are passed by value. How can you create a method that allows you to modify any field from the receiver?
You have to return a value and then modify the object with the new value.
You can't. Methods are read-only.
You have to use a pointer in the receiver when you want to modify any field from the receiver.
You can't. Go can pass parameters by value only.
Is it possible to create methods for native types such as string?
string
No, you'll have a compile error if you try to do it.
Yes, but you can create methods only for string or int.
int
No, you can create only methods for structs.
Yes, but you have to create a custom type wrapper.
Are interfaces in Go explicit or implicit?
Interfaces in Go are implicit. There's no keyword such as implements or symbols such as : to explicitly implement an interface.
implements
:
Interfaces in Go are explicit. You have to use the : symbol.
Interfaces in Go are implicit, but you can implement interfaces only from the current package, not from other packages.
You must answer all questions before checking your work.
Continue
Was this page helpful?