假设student类定义了Name,ClassInfor,StuNumber,利用对象初始化器student类的一个对象并初始化它的属性,下面写法正确的是()
A. student s2 =new student{ ClassInfor =”IT201801”, Name=”ZhangSan”, StuNumber =”10000001”};
B. student s3 =new student{StuNumber =”10000001”};
C. student s1 =new student{Name=”ZhangSan”, ClassInfor =”IT201801”, StuNumber =”10000001”};
D. 以上写法均正确
查看答案
派生类的对象对它的基类成员中的( )是不可访问的。
A. 保护成员
B. 共有成员
C. 内部成员
D. 私有成员
下列描述错误的是( )。
A. 派生类对象可以不受限制地访问所有的基类对象
B. 派生自同一个基类的不同类对象具有一些共同特征
C. 在单一继承中,基类和它的派生存在一种层次关系
D. 派生类构造函数可以通过base关键字调用基类构造函数
有一个基类A,下面选项中的A的派生类B写法正确是?class A{public int a;public A(int a){this.a = a;}}
A. class B : A{public int b;public B(){b = 0;}public B(int a,int b):base(a){this.b = b;}}
B. class B{public int b;public B(int a,int b):base(a){this.b = b;}}
C. class B : A{public int b;public B(int a,int b):base(a){this.b = b;}}
D. class B : A{public int b;public B(){b = 0;}}
创建C#项目文件夹后,默认生成文件及文件夹包括
A. obj
B. program
C. cs.csproj
D. bin