Method New()

BlitzMax Forums/BlitzMax Programming/Method New()

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.

H&K, do you do something to actively prevent it?

I tend to do the following


type blah

global _indirectconstruct:int

method new()
{
  assert( _indirectconstruct, "Use blah.Constructor() to create an object of type blah")
}

function Constructor:blah( params )
{ 
  _indirectconstruct = true

  'do rest of construction here

 _indirectconstruct = false

 'then return object
  return newblah
}

endtype