Inheritance/Single: Difference between revisions
m
→{{header|Lingo}}: 5*s->1
m (→{{header|JavaScript}}: 2*s->1) |
m (→{{header|Lingo}}: 5*s->1) |
||
Line 1,156:
=={{header|Lingo}}==
In Lingo Classes are represented by "parent scripts". Instead of using new() as in the code below, child classes can also use rawNew() when creating an instance of their parent classes. rawNew() creates an instance of a class without calling its initialization function 'new' (constructor).
<syntaxhighlight lang="lingo">
-- parent script "Animal"
-- ...</syntaxhighlight>▼
-- ...
property ancestor
Line 1,165 ⟶ 1,166:
me.ancestor = script("Animal").new()
return me
end
property ancestor
Line 1,173 ⟶ 1,174:
me.ancestor = script("Animal").new()
return me
end
property ancestor
Line 1,181 ⟶ 1,182:
me.ancestor = script("Dog").new()
return me
end
property ancestor
Line 1,189 ⟶ 1,190:
me.ancestor = script("Dog").new()
return me
end
=={{header|Lisaac}}==
|