Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
type Personne struct {
Nom string
Age int
}
type Forme interface {
aire() float64
}
func (p Personne) Saluer() {
fmt.Printf("Bonjour, je m'appelle %s\n", p.Nom)
}
type Cercle struct { rayon float64 }
func (c Cercle) aire() float64 {
return math.Pi * c.rayon * c.rayon
}
p := Personne{Nom: "Alice", Age: 30}