FileDocCategorySizeDatePackage
OverrideField.javaAPI DocExample730Sat Oct 26 09:53:50 BST 2002None

OverrideField

public class OverrideField extends Object
Demonstration of overriding fields.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] av)

		System.out.println("OA's version of getAttr returns: " +
			new OA().getAttr());
		System.out.println("OB's version of getAttr returns: " +
			new OB().getAttr());
		// Declared as OA, instantiated as OB, so gets OB's version of things.
		OA c = new OB();
		System.out.println("C's version of getAttr returns: " +
			c.getAttr());