举一反三
- 已知程序中已经定义了函数test,其原型是int test(int,int,int);,则下列重载形式中正确的是( ) A: double test(int,int,double); B: int test(int,int,int=0); C: float test(int,int,float=3.5F); D: char test(int,int,int);
- 已知程序中已经定义了函数test,其原型如下: int test(int, int, int);则下列重载形式中正确的是( )。 A: char test(int,int,int); B: int test(int,int,double); C: int test(int,int,int=0); D: int TEST(int,int);
- 【单选题】与下述函数原型声明等价的是_______________。 int test(int a[3],int a[3][3]); (1.0分) A. int test(int a[],int a[][]); B. int test(int a[],int a[3][]); C. int test(int a[],int a[][3]); D. int test(int a[3],int a[3][]);
- 已有如下程序: public class Test{ public Test(int x,int y,int z){.....} } 下面哪些方法是合法的构造方法重载:( ) A: Test(){} B: int Test(){} C: Test(int x,int y,byte z){} D: void Test(int x,int y,int z){}
- 下面是关于结构类型与变量的定义语句,错误的是________。 A: struct test{int a; int b; int c;}; struct test y; B: struct test{ int a; int b; int c;} struct test y; C: struct test{ int a; int b; int c;} y; D: struct { int a; int b; int c;} y;
内容
- 0
以下是"public static void test(int x, int y)"的方法重载( ) A: public static void Test(int x) B: public static int test(int x, int y) C: public static void test(int y, int x) D: public static void test(int x, int y)
- 1
有一个类Test,下面为其构造方法的声明,正确的是( )。 A: void Test(int i){} B: test(int i){} C: void test(int i){} D: Test(int i){}
- 2
阅读以下程序,写出运行结果。 #include using namespace std; class Test { private: int num; public: Test(); Test(int n); }; Test::Test() { cout << "Init defa" << endl; num = 0; } Test::Test(int n) { cout << "Init" << " " << n << endl; num = n; } int main() { Test x[2]; Test y(15); return 0; }
- 3
下列程序的输出结果是 _____ 。 #include using namespace std; class Test { public: Test() { cnt++; } ~Test() {cnt--; } static int Count() { returncnt;} private: static int cnt; }; int Test::cnt = 0; int main() { cout << Test::Count()<<' '; Test tl, t2; Test* pT3 = new Test; Test* pT4 = new Test; cout << Test::Count()<<' '; delete pT4; delete pT3; cout << Test::Count()<< endl; return 0; }
- 4
Test类中声明一个整型静态成员函数fun()的正确语句是_____。 A: int static fun(); B: int fun() static; C: static int fun(); D: int Test::fun() static;