Home > Back-end >  Wanted to ask c problems, mainly is the copy function that is not how can, I don't know when he
Wanted to ask c problems, mainly is the copy function that is not how can, I don't know when he

Time:11-07

#include
using namespace std;
The class Mianji
{
Private:
Double l, w;
Public:
Mianji input ()
{
Cin> L> w;
}
Mianji output ()
{
Cout<& lt;" The area of the rectangle is: ";
Cout}
Mianji (double g, double h)
{
L=g;
W=h;
}
Mianji ()
{
L=w=0;
}
Mianji (double g)
{
W=g;
}
Mianji (Mianji & amp; S5)
{
L=s5. L + 10;
W=s5. W + 10;
}
Mianji f1 (Mianji s5)
{
//Mianji s7.
L=l + s5. L;
W=w + s5. W;
//return s7.
}
Mianji fa ()
{
Mianji a;
Return a;
}
Mianji out ()
{
Cout}
};
Int main ()
{
Mianji s4, s5 and s6;
//Mianji s1 [2];
//int I;
//for (I=0; i<2; I++)
//s1 [I]. Input ();
//for (I=0; i<2; I++)
//s1 [I]. The output ();
//Mianji s2 (50);
//s2. Out ();
//s2. The output ();
//Mianji s3 (10, 20);
//s3. The output ();
//s4. The output ();
S4. The input ();
S5. Input ();
S4. F1 (s5);
S4. The output ();
Mianji b;
B=fa ();
B.o utput ();
return 0;
}

CodePudding user response:

Good head ~
His define a copy constructor (does not define the compiler will generate the default), print a message can know whether I call,

CodePudding user response:

Fa is a member function, you need to add class decoration or object instance to a member function in advance
  • Related