package main
import (
"fmt"
)
type Student struct {
Id string
Name string
Age int
Score float64
}
func NewStudent(id string, name string, age int, score float64) Student {
student := Student{id, name, age, score}
return student
}
func main() {
student := NewStudent("st01", "Name 1", 20, 5.6)
fmt.Println("Student Info")
fmt.Println("id: ", student.Id)
fmt.Println("name: ", student.Name)
fmt.Println("age: ", student.Age)
fmt.Println("score: ", student.Score)
}
Student Info
id: st01
name: Name 1
age: 20
score: 5.6