阅读下列程序,程序的运行结果是____。 #include usingnamespacestd; classAnimal { public: voidspeak(){cout<<"animallanguage!"<<endl;} }; classCat:publicAnimal { public: voidspeak(){cout<<"catlanguage:miaomiao!"<<endl;} }; intmain() { Catcat; cat.speak(); }
阅读下列程序,程序的运行结果是____。 #include usingnamespacestd; classAnimal { public: voidspeak(){cout<<"animallanguage!"<<endl;} }; classCat:publicAnimal { public: voidspeak(){cout<<"catlanguage:miaomiao!"<<endl;} }; intmain() { Catcat; cat.speak(); }
定义了Animal类、Cat类和Dog类,则()代码段是正确的。classAnimal{};classCatextendsAnimal{ }classDogextendsAnimal{ } A: Dog[ ] ds=new Dog[5];ds[0]=new Animal(); B: Animal[ ] as=new Animal[5];as[0]=new Dog();
定义了Animal类、Cat类和Dog类,则()代码段是正确的。classAnimal{};classCatextendsAnimal{ }classDogextendsAnimal{ } A: Dog[ ] ds=new Dog[5];ds[0]=new Animal(); B: Animal[ ] as=new Animal[5];as[0]=new Dog();
(7-1)定义了Animal类、Cat类和Dog类,则()代码段是正确的。classAnimal{};classCatextendsAnimal{}classDogextendsAnimal{} A: Dog[] a = new Dog[5];a[0] = new Cat(); B: Animal a = new Animal[5];a[0] = new Animal(); C: Dog[]a = new Dog[5];a[0] = new Animal(); D: Cat[]a = new Cat[5];a[0] = new Cat();
(7-1)定义了Animal类、Cat类和Dog类,则()代码段是正确的。classAnimal{};classCatextendsAnimal{}classDogextendsAnimal{} A: Dog[] a = new Dog[5];a[0] = new Cat(); B: Animal a = new Animal[5];a[0] = new Animal(); C: Dog[]a = new Dog[5];a[0] = new Animal(); D: Cat[]a = new Cat[5];a[0] = new Cat();
1