FileDocCategorySizeDatePackage
SideEffects.javaAPI DocExample1537Sat Nov 25 12:54:18 GMT 2000None

Enemy

public class Enemy extends Object
Simple demo of avoiding side-effects by using Object.clone() to duplicate an object before passing it to your enemy's methods. A bit of a Java hack: Cloneable has no methods, but is tested for by Object.clone. If you implement it, you tell Object.clone that your data is stable enough that field-by-field copy is OK.

Fields Summary
Constructors Summary
Methods Summary
public voidmunge(SideEffects md)

		System.out.println("Object is " + md);
		md.year = 0;
		md.td.setYear(71);