下面的程序段中虚函数被重新定义的方法正确吗?class base{public:virtual int f(int a)=0;......};class derived: public base{public:int f(int a,int b){return 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
He felt ____________ when the shoe repairer first mentioned that he had a tradition to live up to .
A. upset
B. thrilled
C. confused
D. doubtful