客户管理-model

mac2022-06-30  94

package model

import ( “fmt” )

//声明一个Customer结构体,表示一个客户信息 type Customer struct { Id int Name string Gender string Age int Phone string Email string }

//编写一个工厂模式,返回一个Customer的实例 func NewCustomer(id int, name string, gender string, age int, phone string, email string) Customer { return Customer{ Id: id, Name: name, Gender: gender, Age: age, Phone: phone, Email: email, } } //编写一个工厂模式,返回一个Customer的实例 func NewCustomer2(id int, name string, gender string, age int, phone string, email string) Customer { return Customer{ Name: name, Gender: gender, Age: age, Phone: phone, Email: email, } } //返回用户的信息 func(this Customer)Getinfo()string{ info:= fmt.Sprintf("%v\t%v\t%v\t%v\t%v\t%v\t",this.Id,this.Name,this.Age,this.Gender,this.Phone,this.Email) return info//info拼接字符串 }

最新回复(0)