I thought I knew OOP, oops.

BlitzMax Forums/BlitzMax Programming/I thought I knew OOP, oops.

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 have run into a limitation in my knowledge of OOP.
If I write Object1 = Object2, why doesn't Object1 get it's
own block of memory to play with? Instead, they both
share the same memory as you can see if you run this
code below:

here!

Strict
Type testType
	Field a:Int
	Method update()
		a:+1
	EndMethod
EndType

Local test1: testType = New testType
Local test2: testtype = test1

For Local b = 1 To 5
	test1.update
	test2.update
Next

Print test1.a
Print test2.a


How do I copy an object along with all of it's field
values so that it is a separate entity from it's parent?