A: class a
B: class b
C: class c
D: 都不能
举一反三
- Which code, inserted at line 15, allows the class Sprite to compile?() A: Foo{public int bar(){return 1;}} B: new Foo{public int bar(){return 1;}} C: new Foo(){public int bar(){return 1;}} D: new class Foo{public int bar(){return 1;}}
- 已知: class A { public: int a; int b(); int f(); int f(int); int g(); }; class B { public: char f(); int g(); private: int a; int b(); }; class C:public A,public B { }; 设有:C *pc; 则:
- 读代码: public class Test { public static void main (String args[]) { class Foo { public int i = 3; } Object o = (Object) new Foo(); Foo foo = (Foo)o; System.out.println(foo.i); } } 结果是:
- public class Parent{ int change(){... } class Child extends Parent{ } 下面哪些方法可以加入到Child类中( ) A: public int change(){ } B: int change(){} C: int change(int i){} D: void change(){} E: private int change(){}
- 以下那个类声明是正确的( )。 A: public int A1{…} B: public class TT(){} C: public class int Show{} D: public class CD{}
内容
- 0
以下对类A的声明正确的是( )。 A: class A{ int a; public: A next; ... }; B: classs A{ int a; public: void A(); }; C: class A{ int a; A( ); void fun(); } D: class A{ int a; A* next; public: A( ); void fun(); ... };
- 1
以下的类(接口)定义中正确的是( ) A: public class A{ private int x; public getX(){ return x; }} B: public abstract class A{ private int x; public abstract int getX(); public int aMethod(){ return 0; }} C: public class A{ private int x; public abstract int getX();} D: public interface interfaceA{ private int x; public int getX(){ return x; }}
- 2
类的定义如下: public class Parent{ int change( ){ ... } } class Child extends Parent{ } 下面哪些方法可以加入到Child类中( )。 A: public int change( ){ } B: int change( ){ } C: int change(int i){ } D: void change( ){ } E: private int change( ){ }
- 3
如果有,指出下面类模板声明(或声明对)中哪些是非法的。(a)template <class Type> class C1;template <class Type,int size> class C1;(b)template <class T,U,class V> class C2;(c)template <class C1,typename C2>class C3(};(d)template <typename myT,class myr> class C4{};(e)template <class Type,int*ptr> class C5;template <class T,int*pi>class C5;
- 4
判断C#类MyClass的定义中哪些定义是合法的抽象类 A: abstract class Myclass{ abstract int getCount();} B: private abstract class Myclass{ abstract int getCount();} C: abstract class Myclass{ public abstract int getCount();} D: sealed abstract class Myclass{ abstract int getCount();}