The Prototype of Memory Cloning
Replicating ActiveX controls using horrifying serialization tricks.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Necromancy // Cloning
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// VB PATTERN //
' ICloneable.cls
Public Function Clone() As Object
End Function
' ZombieControl.cls
Implements ICloneable
Public CurseLevel As Integer
Private Function ICloneable_Clone() As Object
Dim cloneObj As ZombieControl
Set cloneObj = New ZombieControl
cloneObj.CurseLevel = Me.CurseLevel
' Shallow copy the curse
Set ICloneable_Clone = cloneObj
End Function
When the cost of instantiating an ActiveX control tears at the fabric of system resources, the Prototype allows an Adept to rip a copy directly from memory, carrying over its state and its curses.
Runic Tags:
#prototype
#clone
#activex