2024-01-20 15:21:37 +00:00
|
|
|
package structs
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type customer struct{
|
|
|
|
firstName string
|
|
|
|
lastName string
|
|
|
|
age int
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c customer) save() {
|
|
|
|
fmt.Println("Has been added : ", c.firstName, c.lastName,c.age)
|
|
|
|
}
|
|
|
|
|
2024-01-20 15:24:00 +00:00
|
|
|
func (c customer) update() {
|
|
|
|
fmt.Println("Updated : ", c.firstName, c.lastName, c.age)
|
|
|
|
}
|
|
|
|
|
2024-01-20 15:21:37 +00:00
|
|
|
func Demo2() {
|
|
|
|
c:= customer{firstName: "Engin", lastName: "Demiroğ", age: 35}
|
|
|
|
c.save()
|
2024-01-20 15:24:00 +00:00
|
|
|
c.update()
|
2024-01-20 15:21:37 +00:00
|
|
|
}
|