// This example demonstrates how an enhanced visitable type can be
// used as though it were a tree of nodes.
This example demonstrates how an enhanced visitable type can be
used as though it were a tree of nodes.
// This example demonstrates how an enhanced visitable type can be // used as though it were a tree of nodes .
func Example_abstract() {
	data, _ := demo.NewContainer(true)
	for i := 0; i < data.TargetCount(); i++ {
		child := data.TargetAt(i)
		if child == nil {
			fmt.Printf("%d: nil\n", i)
		} else {
			fmt.Printf("%d: %s %s\n", i, child.TargetTypeID(), reflect.TypeOf(child))
		}
	}
}
func Example_abstract ( ) { data , _ := demo . NewContainer ( true ) for i := 0 ; i < data . TargetCount ( ) ; i ++ { child := data . TargetAt ( i ) if child == nil { fmt . Printf ( " \n " , i ) } else { fmt . Printf ( " \n " , i , child . TargetTypeID ( ) , reflect . TypeOf ( child ) ) } } }
This example demonstrates how an enhanced visitable type can be
used as though it were a tree of nodes.
This example demonstrates how an enhanced visitable type can be used as though it were a tree of nodes .
//Output: //0: ByRefType *demo.ByRefType //1: ByRefType *demo.ByRefType //2: []ByRefType *demo.targetAbstract //3: []*ByRefType *demo.targetAbstract //4: ByValType *demo.ByValType //5: ByValType *demo.ByValType //6: []ByValType *demo.targetAbstract //7: []*ByValType *demo.targetAbstract //8: nil //9: ByValType *demo.ByValType //10: ByValType *demo.ByValType //11: ByValType *demo.ByValType //12: ByValType *demo.ByValType //13: []Target *demo.targetAbstract //14: []*Target *demo.targetAbstract //15: []Target *demo.targetAbstract