请问怎么调用拷贝构造函数
#include<iostream.h>#include<conio.h> //getch()要用到此头文件
#include<stdlib.h> //system("cls")清屏函数用到此头文件
#include<string.h>
#include<math.h>
class fushu
{
public:
fushu (double A,double B,char C,char D,double E,double F)
{a=A;
b=B;
c=C;
d=D;
e=E;
f=F;
cout<<"构造函数被调用"<<endl;
}
fushu (fushu& p)
{
a=p.a;
b=p.b;
c=p.c;
d=p.d;
e=p.e;
f=p.f;
cout<<"拷贝构造函数被调用"<<endl;
}
~fushu()
{
cout<<"析构函数被调用"<<endl;
}
void jisuan (){
if (d=='+')
cout<<a+e<<"+"<<b+f<<"i"<<endl;
if (d=='-')
cout<<a-e<<"+"<<b-f<<"i"<<endl;
if (d=='*')
cout<<a*e-b*f<<"+"<<b*e+a*f<<"i"<<endl;
if (d=='/')
cout<<a*e-b*f/(e*e+f*f)<<"+"<<b*e+a*f/(e*e+f*f)<<"i"<<endl;
}
private:
double a;
double b;
char c;
char d;
double e;
double f;
};
int main()
{
double A;
double B;
char C;
char D;
double E;
double F;
cin>>A>>B>>C>>D>>E>>F;
fushu p (A,B,C,D,E,F);
p.jisuan();
}
好奇怪,我的拷贝构造函数好像没调用啊,请问应该怎么改呢,我有点懵