Hello Now I am trying to convert Java to Go.
But I have problem with using method declared for structure.
Before put structure in Array, Method could be loaded and used.
After put it in array, I cannot call method for it.
Can you check below codes?
Result said me that dvdCollection.DVD undefined (type [15]*DVD has no field or method DVD)
type DVD struct {
name string
releaseYear int
director string
}
func (d *DVD) AddDVD(name string, releaseYear int, director string) {
d.name = name
d.releaseYear = releaseYear
d.director = director
}
func main() {
dvdCollection := [15]DVD{}
dvdCollection.AddDVD("Terminator1", 1984, "James Cameron")
}