In C# to create a public method you must use this:
public void CreateBook(Book book){
//do something
}
In Go to create a public function you must use this:
func CreateBook(product *structs.Product) error {
//do something
}
Note that in C# it is necessary to use the reserved word public
and to create a private method, private
is used.
In C# they are called Access Modifiers, there are others, you can check the complete list here: C# Access Modifiers - Reference.
In Go to differentiate public from private functions, the initial of the function name is used.
For public functions, capital letter is used. Example: CreateBook().
For private functions use lowercase initials. Example: createBook().
Top comments (0)