b3d after command in bmax?

BlitzMax Forums/BlitzMax Beginners Area/b3d after command in bmax?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I know I'm new to this'ere OO malarky but can't you just extend a base type?...

Strict

Type TBase
	Field link:TLink
	
	Method AddFirst(list:TList) ' Just for consistency
		link = list.AddFirst(Self)
	End Method
	
	Method AddBefore(obj:TBase, list:TList)
		link = list.InsertBeforeLink(Self, obj.link)
	End Method
	
	Method AddAfter(obj:TBase, list:TList)
		link = list.InsertAfterLink(Self, obj.link)
	End Method
	
	Method AddLast(list:TList) ' Just for consistency
		link = list.AddLast(Self)
	End Method
	
	Method First:Object(list:TList) ' Just for consistency
		Return list.First()
	End Method
	
	Method After:Object()
		Return link.NextLink().Value()
	End Method
	
	Method Before:Object()
		Return link.PrevLink().Value()
	End Method
	
	Method Last:Object(list:TList) ' Just for consistency
		Return list.Last()
	End Method
	
	Method Remove()
		link.Remove()
	End Method
End Type

Type TTest Extends TBase
	Field id:String
End Type

Local testList:TList = New TList

Local a:TTest = New TTest
a.id = "a"
a.AddLast(testList)

Local b:TTest = New TTest
b.id = "b"
b.AddBefore(a, testList)

Local c:TTest = New TTest
c.id = "c"
c.AddFirst(testList)

For Local t:TTest = EachIn testList
	Print t.id
Next

Print 
Print TTest(b.After()).id
Print TTest(a.Before()).id
Print TTest(b.Before()).id
Print 

a.Remove()

Print
For Local t:TTest = EachIn testList
	Print t.id
Next

Print
Print TTest(b.First(testList)).id