Go Example: Creating a Chanel Structure
package main
import ( "fmt" )
type Chanel struct { name string region string }
func (c Chanel) getInfo() { fmt.Printf('Chanel brand is made in %s and it is known for its luxury fashion and accessories. ', c.region) }
func main() { chanel := Chanel{ name: 'Chanel', region: 'Paris, France', }
fmt.Printf('Welcome to the world of %s
', chanel.name) chanel.getInfo() }
// Output: // Welcome to the world of Chanel // Chanel brand is made in Paris, France and it is known for its luxury fashion and accessories.
原文地址: https://www.cveoy.top/t/topic/lvC5 著作权归作者所有。请勿转载和采集!