JiafanZhou
版主
发贴: 736
积分: 61
|
于 2009-10-23 19:01
午夜蓝调 wrote: 这段声明to和cont方法是什么方法?为什么要声明? 前面为什么还要各跟一个Destination和Contents?请教各位高手,谢谢
to() and cont() are methods no difference from other methods of the P class.
PS: consider to give your classes and methods meaningful names will help others to understand code.
Destination and Contents are inner classes of P class. (as your title has already suggested). Some attentions need to be noted when using inner classes. - Inner classes are members of the class who contains them. So you should just treat them as members. - Inner classes have visibility control like other members. (you can declare inner classes as private, public and even static) - The compiled inner class will have the following name: xxx$yyy (where xxx is the "base" class, and yyy is the inner class) - Invoke the inner classes the same way as invoke a method or a field. -...
When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.
|