Jump to content

Inheritance/Single: Difference between revisions

m
(add JavaScript, clean whitespace)
Line 256:
Here is how this would normally be done:
 
<lang Jj>coclass 'Animal'</lang>
<lang Jj>coclass 'Dog'
coinsert 'Animal'</lang>
<lang Jj>coclass 'Cat'
coinsert 'Animal'</lang>
<lang Jj>coclass 'Lab'
coinsert 'Dog'</lang>
<lang Jj>coclass 'Collie'
coinsert 'Dog'</lang>
 
 
See http://www.jsoftware.com/help/jforc/modular_code.htm
 
That said, some operations in J -- including <code>coinsert</code> -- will create classes if they did not already exist. So the above may be simplified to:
 
<lang Jj>coinsert_Dog_ 'Animal'
coinsert_Cat_ 'Animal'
coinsert_Lab_ 'Dog'
coinsert_Collie_ 'Dog'</lang>
 
=={{header|Java}}==
892

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.