I'm trying to put a vector variable inside a struct in Google's Go programming language. This is what I have so far:
Want:
type Point struct { x, y int }
type myStruct struct {
myVectorInsideStruct vector;
}
func main(){
myMyStruct := myStruct{vector.New(0)};
myPoint := Point{2,3};
myMyStruct.myVectorInsideStruct.Push(myPoint);
}
Have:
type Point struct { x, y int }
func main(){
myVector := vector.New(0);
myPoint := Point{2,3};
myVector.Push(myPoint);
}
I can get the vector to work in my main function just fine, but I want to encapsulate it inside a struct for easier use.