- 11
- 0
- 约1.28万字
- 约 41页
- 2016-10-06 发布于天津
- 举报
interfacesandpolymorphism
Using Interfaces for Callbacks add method asks measurer (and not the added object) to do the measuring public void add(Object x) { sum = sum + measurer.measure(x); if (count == 0 || measurer.measure(maximum) measurer.measure(x)) maximum = x; count++; } Using Interfaces for Callbacks You can define measurers to take on any kind of measurement public class RectangleMeasurer implements Measurer { public double measure(Object anObject) { Rectangle aRectangle = (Rectangle) anObject; double area = aRectangle.getWidth() * aRectangle.getHeight();
您可能关注的文档
- finalprojectreportforintrotodatamining-pedroc.exposito.doc
- fileinformato.ppt-clan-destino.ppt
- flavel-theflavels.doc
- formatforsubmissionofannualreportofbiomedicalwaste.doc
- formatoworddellacircolaredel9giugno2016,n.17(doc-346kb).doc
- formatword-ilay.doc
- fueloilspecification-ebonyoilandgaslimited.doc
- fitursupply-bnp2tki.ppt
- fundamentalsofmanagement6e.ppt
- futureedi-whatcomesafterx12andedifact-rawlinsec.ppt
原创力文档

文档评论(0)