标签:芯片 ++ nbsp img ios iostream oid 分享图片 name
1.芯片
class xinpian{
public:
xinpian(int m0,int n0);
void jia();
private:
int m;
int n;
};
class xinpianA:public xinpian{
public:
xinpianA(int m0,int n0);
void jian();
private:
int m;
int n;
};
class xinpianB:public xinpian{
public:
xinpianB(int m0,int n0);
void chen();
private:
int m;
int n;
};
class xinpianC:public xinpian{
public:
xinpianC(int m0,int n0);
void chu();
private:
int m;
int n;
};
#include"xinpian.h"
#include<iostream>
using namespace std;
xinpian::xinpian(int m0,int n0):m(m0),n(n0){
};
void xinpian::jia(){
cout<<m+n<<endl;
};
xinpianA::xinpianA(int m0,int n0):xinpian(m0,n0),m(m0),n(n0){
};
void xinpianA::jian(){
cout<<m-n<<endl;
};
xinpianB::xinpianB(int m0,int n0):xinpian(m0,n0),m(m0),n(n0){
};
void xinpianB::chen(){
cout<<m*n<<endl;
};
xinpianC::xinpianC(int m0,int n0):xinpian(m0,n0),m(m0),n(n0){
};
void xinpianC::chu(){
cout<<m/n<<endl;
}
#include"xinpian.h"
#include<iostream>
using namespace std;
int main()
{
xinpianA A(5,2);
A.jia();
A.jian();
xinpianB B(6,3);
B.jia();
B.chen();
xinpianC C(7,4);
C.jia();
C.chu();
return 0;
}
标签:芯片 ++ nbsp img ios iostream oid 分享图片 name
原文地址:https://www.cnblogs.com/devin-booker/p/9119310.html