Anonymous user
Polymorphic copy: Difference between revisions
→{{header|Nimrod}}
Line 981:
=={{header|Nimrod}}==
<lang nimrod>type
T = ref object of TObject
myValue: string
S1 = ref object of T
S2 = ref object of T
method speak(x: T) = echo "T Hello ", x.myValue
Line 999:
echo "Making copy of a as u, colors and types should match"
u.deepCopy(a)
u.speak
a.speak
Line 1,033:
Assigning new color to u. Since u,b references same object b's color changes as well
S2 Woof Yellow
S2 Woof
=={{header|Objective-C}}==
|