Telegram Group & Telegram Channel
Note #10 Напоминание самому себе:

В Go можно делать вызов метода, напрямую используя тип:

package main

import (
"fmt"
)

type Person struct {
Name string
}

func (p Person) Say() {
fmt.Println("Go for two me and", p.Name)
}

func main() {
p := Person{"%username%"}
// Все варианты эквивалентны
p.Say()
Person.Say(p)
(Person).Say(p)
f1 := Person.Say; f1(p)
f2 := (Person).Say; f2(p)
}

links:
[1] https://play.golang.org/p/5TbFC1DsZyy
[2] https://golang.org/ref/spec#Method_expressions



tg-me.com/golang_for_two/34
Create:
Last Update:

Note #10 Напоминание самому себе:

В Go можно делать вызов метода, напрямую используя тип:

package main

import (
"fmt"
)

type Person struct {
Name string
}

func (p Person) Say() {
fmt.Println("Go for two me and", p.Name)
}

func main() {
p := Person{"%username%"}
// Все варианты эквивалентны
p.Say()
Person.Say(p)
(Person).Say(p)
f1 := Person.Say; f1(p)
f2 := (Person).Say; f2(p)
}

links:
[1] https://play.golang.org/p/5TbFC1DsZyy
[2] https://golang.org/ref/spec#Method_expressions

BY 🇺🇦 Go for two :)




Share with your friend now:
tg-me.com/golang_for_two/34

View MORE
Open in Telegram


🇺🇦 Go на двоих Telegram | DID YOU KNOW?

Date: |

The S&P 500 slumped 1.8% on Monday and Tuesday, thanks to China Evergrande, the Chinese property company that looks like it is ready to default on its more-than $300 billion in debt. Cries of the next Lehman Brothers—or maybe the next Silverado?—echoed through the canyons of Wall Street as investors prepared for the worst.

🇺🇦 Go на двоих from us


Telegram 🇺🇦 Go for two :)
FROM USA