Topic: 一个类被声明为protected意味着什么? |
Print this page |
1.一个类被声明为protected意味着什么? | Copy to clipboard |
Posted by: jacksun Posted on: 2003-03-18 16:25 RT。 另外,如果该声明为"protected"的类包含一些"abstract"的方法,那么"abstract"表示什么意思? 可参考的文档如下: http://myhome.naver.com/pumila/doc/java.midp.siemens/com/siemens/mp/game/GraphicObject.html |
2.Re:一个类被声明为protected意味着什么? [Re: jacksun] | Copy to clipboard |
Posted by: snowbug Posted on: 2003-03-18 23:10 It seems that the class itself is still public while the constructor is protected. A protected constructor means that the class can not be directly instanciated but it can be accessed from the constructor of its sub-classes (as oppose to private constructor, which can not be accessed from the sub-classes). The abstract keyword means that those methods are not implemented in the class and the sub class must provide a concrete implemenation if unless the sub-class is also declared abstract. |
3.Re:一个类被声明为protected意味着什么? [Re: jacksun] | Copy to clipboard |
Posted by: jacksun Posted on: 2003-03-19 00:07 I got it. Thanks snowbug! But is it appropriate for a class contains an abstract method? It is supposed every method reside in a class should be implemented. I don't know whether it is correct to say that only interface and abstract class contains abstract method. Best regards. |
4.Re:一个类被声明为protected意味着什么? [Re: jacksun] | Copy to clipboard |
Posted by: Tormz Posted on: 2003-03-19 13:17 Can a class be declare protect? only the field or the member method can be specify protect~ |
5.Re:一个类被声明为protected意味着什么? [Re: Tormz] | Copy to clipboard |
Posted by: learner Posted on: 2003-03-20 04:46 Tormz wrote: A class can only have "public" or default modifier, except inner classes - which can also have "private" and "protected". |
6.Re:一个类被声明为protected意味着什么? [Re: jacksun] | Copy to clipboard |
Posted by: learner Posted on: 2003-03-20 04:53 jacksun wrote: A class must be declared abstract when it: - has abstract method( s ) - is a subclass of another class that has abstract method( s ), which itself does not provide the implementation - implements an interface that has abstract method( s ), which itself does not provide the implementation |
7.Re:一个类被声明为protected意味着什么? [Re: jacksun] | Copy to clipboard |
Posted by: xiaopan Posted on: 2003-03-22 15:55 (缩略图,点击图片链接看原图) |
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 |