{"id":777,"date":"2019-12-01T07:02:54","date_gmt":"2019-12-01T07:02:54","guid":{"rendered":"https:\/\/golangbyexamples.com\/?p=777"},"modified":"2019-12-01T07:08:58","modified_gmt":"2019-12-01T07:08:58","slug":"difference-between-method-function-go","status":"publish","type":"post","link":"https:\/\/golangbyexamples.com\/difference-between-method-function-go\/","title":{"rendered":"Difference between method and function in GO"},"content":{"rendered":"\n
There are some important differences between method and function. Let’s see the signature of both<\/p>\n\n\n\n
Function:<\/strong><\/p>\n\n\n\n Method:<\/strong><\/p>\n\n\n\n There are some important differences between method and function. Let’s see the signature of both Function: Method: From the above signature, it is clear that method has a receiver argument. A receiver…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[97,3,4,93],"class_list":["post-777","post","type-post","status-publish","format-standard","hentry","category-tech","tag-function","tag-go","tag-golang","tag-method"],"yoast_head":"\nfunc some_func_name(arguments) return_values<\/code><\/pre>\n\n\n\n
func (receiver receiver_type) some_func_name(arguments) return_values<\/code><\/pre>\n\n\n\n
From the above signature, it is clear that method has a receiver argument. A receiver can be a struct or any other type. The method will have access to the properties of the receiver and can call the receiver’s other methods.
This is the only difference between function and method, but due to it they differ in terms of functionality they offer
<\/p>\n\n\n\n