|
阅读:556回复:1
this,super这两个东西
class A
{ int x;//类A中声明了成员变量x ...... } class B extends A { int x; //B类中也声明了成员变量x ...... void m() { int x; //方法m中声明了自己的局部变量x ...... super.x=2; //super.x是所在类的父类即类A的x this.x=1; //this.x是其所在类既类B的x x=100; //x是方法本身的局部变量x ..... } |
|
|
|
1C#
发布于:2005-10-17 10:20
Re:this,super这两个东西
呵呵,顺便说明一下构造函数里的super吧~~ |
|
|