types in types

Blitz3D Forums/Blitz3D Programming/types in types

This would be a good situation for SQL for Custom Types.

A alternate means would be create two separate derivatives from the base tree object.
Type tree
	Field treetype$
End Type

Type greenforest
	Field t.tree
End Type

Type brownforest
	Field t.tree
End Type
Kind of a weird reverse inheritance thingy? You loop through the forest, not the tree. Of course with each derivative will have its own deletion function.
Example:

Function brownforestDelete(this.brownforest)
	If this<>Null 
		delete this\tree
		delete this
	EndIf
End Function
In this particular situation I dont see a need for a type within type so I would get rid of the tree or the forest and throw everything into one type, adding a field like 'typeid', 'kind', 'species' to disquingish them.
Type Tree
	Field id%
	Field typeid% ;1:Green, 2:Brown
End Type
Some similar to what GitTech did, but just with one type.