Abstract type: Difference between revisions
Content added Content deleted
Line 2,391: | Line 2,391: | ||
# 42 |
# 42 |
||
</lang> |
</lang> |
||
=={{header|Phix}}== |
|||
In many senses the object type is a completely abstract type, since it can hold anything, from native integers to class instances. |
|||
You can also have explicitly abstract classes (and/or abstract methods). Needs 0.8.1+ |
|||
<lang Phix>abstract class job |
|||
integer id |
|||
-- procedure test(); -- (the ; makes it an abstract method) |
|||
procedure show() |
|||
printf(1,"this is job:%d\n",id) |
|||
end procedure |
|||
end class |
|||
--job j = new({1}) -- compilation error: "abstract class" |
|||
class errand extends job |
|||
end class |
|||
errand e = new({2}) |
|||
e.show()</lang> |
|||
{{out}} |
|||
<pre> |
|||
this is job:2 |
|||
</pre> |
|||
=={{header|PHP}}== |
=={{header|PHP}}== |