Topic: this用法 急用!! |
Print this page |
1.this用法 急用!! | Copy to clipboard |
Posted by: fgh520 Posted on: 2006-05-30 11:20 public class Director { private Builder builder; public Director( Builder builder ) { this.builder = builder; } // 将部件partA partB partC最后组成复杂对象 //这里是将车轮 方向盘和发动机组装成汽车的过程 public void construct() { builder.buildPartA(); builder.buildPartB(); builder.buildPartC(); } } this后面 第一个builder指的是哪个builder?斑竹。 |
2.Re:this用法 急用!! [Re: fgh520] | Copy to clipboard |
Posted by: lisliefor Posted on: 2006-05-30 11:55 this关键字代表该类的当前实例,this后面的builder只该类中private Builder builder。 =号后的builder,是Director(...)方法中的参数builder。 |
3.Re:this用法 急用!! [Re: fgh520] | Copy to clipboard |
Posted by: ranchgirl Posted on: 2006-05-30 12:50 This is some sample code for GoF's builder pattern... Read more on GoF's book. |
4.Re:this用法 急用!! [Re: fgh520] | Copy to clipboard |
Posted by: Jason_hero Posted on: 2006-05-30 14:50 请看下面注释行: public class Director { private Builder builder; //下面的this.builder指代此处的builder public Director( Builder builder ) { this.builder = builder; } |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |