Extending Singletons?

BlitzMax Forums/BlitzMax Programming/Extending Singletons?

IE: no fields, no methods, just globals and functions.
Actually, a 'proper' Singleton has mostly methods and fields - but only one function (getInstance). Like so:
'Hello World Singleton example - by FlameDuck
SuperStrict

Type Singleton Final ' It needs to not be extendable to ensure that there truely is only one object in play at any time.
	Global myInstance:Singleton' This should actually be Private, so that it is only accessible to the Singleton in question. 
	Field somedata:String

	'Here you would normally have a private constructor, again to prevent other classes from arbitrarilly creating their own instances.
	'BlitzMAX dose not properly support access modifiers, so you'll have to be a better programmer, and remember not to do it yourself. Ever.

	Function getInstance:Singleton()
		If myInstance = Null
			myInstance = New Singleton
		End If
		Return myInstance
	End Function
	
	Method someMethod:String()
		Return somedata
	End Method
	
	Method someotherMethod( aString:String )
		somedata = aString
	End Method
End Type

Singleton.getInstance().someOtherMethod("Hello World")
Print Singleton.getInstance().someMethod()
Ofcourse there is no way to currently do this 'right' in BlitzMAX.