Topic: 对象没有实例名,那么如何对它操作?

  Print this page

1.对象没有实例名,那么如何对它操作? Copy to clipboard
Posted by: ysonic
Posted on: 2005-06-13 13:38

比如
class a{
x;
a(){}
}
new a;

新生成的a对象没有实例名,那么如何对它操作?
怎么给x赋值?

2.Re:对象没有实例名,那么如何对它操作? [Re: ysonic] Copy to clipboard
Posted by: snowbird2005
Posted on: 2005-06-13 16:26

例:
new a().x=1

3.Re:对象没有实例名,那么如何对它操作? [Re: ysonic] Copy to clipboard
Posted by: ysonic
Posted on: 2005-06-13 21:35

这是构造的时候赋值吧。
可是构造以后再想改变x呢?

4.Re:对象没有实例名,那么如何对它操作? [Re: ysonic] Copy to clipboard
Posted by: why
Posted on: 2005-06-13 21:42

Why do you want to do so?

...

The answer is clearly NO.
Why do you think that this might be possible???

5.Re:对象没有实例名,那么如何对它操作? [Re: ysonic] Copy to clipboard
Posted by: ysonic
Posted on: 2005-06-13 22:21

我做了一个程序,需要这样。可能这样做很笨,有更好的方法,但是我想知道能不能这样做。

6.Re:对象没有实例名,那么如何对它操作? [Re: ysonic] Copy to clipboard
Posted by: zerol
Posted on: 2005-06-13 23:47

using anonymous inner class

7.Re:对象没有实例名,那么如何对它操作? [Re: ysonic] Copy to clipboard
Posted by: ysonic
Posted on: 2005-06-14 14:20

说明白点好么?
谢谢~


   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