以下那个类声明是正确的( )。
A: public int A1{…}
B: public class TT(){}
C: public class int Show{}
D: public class CD{}
A: public int A1{…}
B: public class TT(){}
C: public class int Show{}
D: public class CD{}
举一反三
- 在下列类族声明的代码中,正确的访问类N的成员a的语句为 。 class N { public: int a; void display(){cout<<″A::a=”<<a<<endl;} }; class A:public N { public: int a1; }; class B:public N { public: int a2; }; class C :public A,public B { public : int a3; void show{cout<<″a3=″<<a3<<endl;} }; int main { C c1;//定义C类对象c1 ┆ }
- 以下对类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(); ... };
- 下面哪个程序变量age的定义是正确的() A: public class Employee{ public void show(){ System.out.println(age); } public int age; } B: public class Employee{ public void show(){ System.out.println(age); int age = 20; } } C: public class Employee{ public void show(){ System.out.println(age); } }
- 下列哪个类声明是正确的( ) A: public void A1{…} B: public class Move(){…} C: public class void number{…} D: public class Car{…}
- 以下的类(接口)定义中正确的是( ) 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; }}