package main
import (
"fmt"
)
type Student struct {
Id string
Name string
Age int
}
func (student *Student) Change(id string, name string, age int) {
student.Id = id
student.Name = name
student.Age = age
}
func main() {
student := Student{
Id: "st01",
Name: "Name 1",
Age: 20,
}
fmt.Println(student)
student.Change("st02", "Name 2", 22)
fmt.Println(student)
}
Output
{st01 Name 1 20}
{st02 Name 2 22}