









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Hicks; Class: PROG LANG TECH & PDGMS; Subject: Computer Science; University: University of Maryland; Term: Spring 2006;
Typology: Study notes
1 / 15
This page cannot be seen from the preview
Don't miss anything!










1
3
public interface Node { } public class Number extends Node { public int n; } public class Plus extends Node { public Node left; public Node right; }
public interface Node { public int sum(); } public class Number extends Node { public int n; public int sum() { return n; } } public class Plus extends Node{ public Node left; public Node right; public int sum() { return left.sum() + right.sum(); } }
7
9
13
public interface Node { public void accept(Visitor v); } public class Number extends Node { … public void accept(Visitor v) {v.visitNumber(this);} } public class Plus extends Node { … public void accept(Visitor v) {v.visitPlus(this);} }
15
19
21
25
27