Inheritance/Single: Difference between revisions

(make J implementation typical, with each class defined in a different script)
Line 278:
 
=={{header|J}}==
 
Here is how this would normally be done:
 
<lang J>coclass 'Animal'</lang>
<lang J>coclass 'Dog'
Line 290 ⟶ 293:
 
See http://www.jsoftware.com/help/jforc/modular_code.htm
 
That said, some operations in J -- including coinsert -- will create classes if they did not already exist. So the above may be simplified to:
 
<lang J>coinsert_Dog_'Animal'
coinsert_Cat_'Animal'
coinsert_Lab_'Dog'
coinsert_Collie_'Dog'</lang>
 
=={{header|Java}}==
6,962

edits