She has a bright voice and perfect sense of music, so she was born to be a singer.
查看答案
It’s a quarter past 8 o’clock. It’s time for us to have the first class.
对下面的代码说法正确的是()classBaseclass{protectedBaseclass(stringa,stringb){Console.WriteLine("基类中构造函数");}}classDerivcedlcass:Baseclass{publicDerivcedlcass(stringa,stringb):base(a,b){Console.WriteLine("派生类中的构造函数");}}
A. 代码无错误,派生类可以实例化,基类只有通过派生类实例化
B. 代码有错误,派生类的base关键字中不应带有参数
C. 代码无错误,基类可以实例化
D. 代码有错误,base关键字中的参数应改为"base(c,d)"
下面代码执行结果正确的是classBaseclass{publicvirtualintShow(){return5;}}classDerivcedlcass:Baseclass{publicnewintShow(){return6;}}classDerivcedlcass1:Baseclass{publicoverrideintShow(){return7;}}classProgram{staticvoidMain(string[]args){Baseclass[]a=newBaseclass[2];a[0]=newDerivcedlcass();a[1]=newDerivcedlcass1();Console.WriteLine("a[0]={0}",a[0].Show());Console.WriteLine("a[1]={0}",a[1].Show());}}
A. a[0]=7,a[1]=6
B. a[0]=6,a[1]=5
C. a[0]=5,a[1]=7
D. a[0]=7,a[1]=5
C#提供一个默认的无参构造函数,当实现了另外一个有一个参数的构造函数时,还想保留这个无参数的构造函数。这样至少应该写()个构造函数。