Content deleted Content added
WP:COMPUTING Tagging ( False Postive ?? ) :(Plugin++) Added {{WikiProject Computing}}. |
→Mistake in example?: new section |
||
Line 47:
[http://en.wikipedia.org/w/index.php?title=Proxy_pattern&diff=next&oldid=23670715 This edit] seems a copyright violation from http://userpages.umbc.edu/~tarr/dp/lectures/Proxy.pdf (4/4/2004; 69 KB) the date of pdf is set before the edit [[User:Lusum|Lusum]] ([[User talk:Lusum|talk]]) 11:23, 11 June 2008 (UTC)
== Mistake in example? ==
Current version:
<source lang="java">
class ProxyImage implements Image {
private String filename;
private Image image;
public ProxyImage(String filename) { this.filename = filename; }
public void displayImage() {
if (image == null) {
image = new RealImage(filename); // load only on demand
}
image.displayImage();
}
}
</source>
Can interfaces such as "Image" be used as types?
Would this (still) be correct?
<source lang="java">
class ProxyImage implements Image {
private String filename;
private RealImage image;
public ProxyImage(String filename) { this.filename = filename; }
public void displayImage() {
if (image == null) {
image = new RealImage(filename); // load only on demand
}
image.displayImage();
}
}
</source>
Notice the difference between <code>private Image image;</code> and <code>private RealImage image;</code>.
Thanks, [[User:Abdull|Abdull]] under IP --[[Special:Contributions/134.91.225.10|134.91.225.10]] ([[User talk:134.91.225.10|talk]]) 16:24, 18 September 2008 (UTC)
|