Assuming, that I have a Graph
struct, like so:
type Graph struct {
nodes []int
adjList map[int][]int
}
// some methods on the struct
// constructor
func New() *Graph {
g := new(Graph)
g.adjList = make(map[int][]int)
return g
}
Now, I create a new instance of that struct, with: aGraph := New()
.
How do I access the fields of this particular instance of the Graph
struct (aGraph
)?
In other words, how do I access aGraph
's version of the nodes
array, (from within another top-level function for example)?
Any help is extremely appreciated!