题目内容

有如下程序:#includeusing namespace std;class shapes{protected:int x,y;public:void setvalue(int d,int w=0){x=d;y=w;}virtual void disp()=0;};class square:public shapes{public:void disp(){cout<setvalue(10,5);ptr->disp();return 0;}

A. 50
B. 5
C. 10
D. 15

查看答案
更多问题

下面的程序段中虚函数被重新定义的方法正确吗?class base{public:virtual int f(int a)=0;......};class derived: public base{public:int f(int a,int b){return a*b;}......};

A. 对
B. 错

(1)写出程序的运行结果。#includeusing namespace std;class Stock{public:void print(){cout<<"Stock class.\n";}};class Der1_Stock:public Stock{public:void print(){cout<<"Der1_Stock class.\n";}};class Der2_Stock:public Stock{public:void print(){cout<<"Der2_Stock class.\n";}};int main(){Stock *ptr,s1;Der1_Stock d1;Der2_Stock d2;ptr=&s1;ptr->print();ptr=&d1;ptr->print();ptr=&d2;ptr->print();return 0;}(2)修改上一题的程序,使运行结果为:Stock class.Der1_Stock class.Der2_Stock class.

1. The auther went quickly into the shop to ___________ .

A. buy a pair of shoes
B. meet one of his old friends
C. have his shoes repaired
D. learn to build a tradition

The author became a little impatient for ________________ .

A. he couldn't stand up with the shoe repairer's modest attitude
B. he was in a hurry to meet a friend
C. the shoe repairer was sad and did nothing about his torn shoes
D. it took the shoe repairer a long time to have his shoes repaired

答案查题题库