使用Integer类,定义派生类Vector类:
class Integer { //… protected : int n; }; class Vector:public Integer { //… protected : int *v; };
其中,数据成员v用于建立向量,n为向量长度。要求:类的成员函数可以实现向量的基本算术运算。
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题