dddsss
پنج شنبه 07 مهر 1390, 12:54 عصر
class Table{
private:
int Length;
int Width;
int Height;
public:
Table(){Length=0;Width=0;Height=0;};
Table(int,int,int);
void operator=(Table);
};
Table::Table(int GotL,int gotW,int gotH)
{
Length=GotL;
Width=gotW;
Height=gotH;
}
void Table::operator=(Table RightOp){
this->Length = RightOp.Length;
this->Width = RightOp.Width;
this->Height = RightOp.Height;
}
int main(){
Table D;
Table Lunch(30,20,60),Supper(25,30,50);
D = Lunch = Supper;
system("Pause");
return EXIT_SUCCESS;
}
سوالم اینه، توی Main بعد از این که انتساب Supper به Lunch صورت میگیره چه بلایی سر لانچ میاد که نمیشه به D انتسابش کرد؟ مرض Void چیه؟
در ضمن میدونم راه حلش اینه که return * this بزارم ولی مورد این چیه؟
private:
int Length;
int Width;
int Height;
public:
Table(){Length=0;Width=0;Height=0;};
Table(int,int,int);
void operator=(Table);
};
Table::Table(int GotL,int gotW,int gotH)
{
Length=GotL;
Width=gotW;
Height=gotH;
}
void Table::operator=(Table RightOp){
this->Length = RightOp.Length;
this->Width = RightOp.Width;
this->Height = RightOp.Height;
}
int main(){
Table D;
Table Lunch(30,20,60),Supper(25,30,50);
D = Lunch = Supper;
system("Pause");
return EXIT_SUCCESS;
}
سوالم اینه، توی Main بعد از این که انتساب Supper به Lunch صورت میگیره چه بلایی سر لانچ میاد که نمیشه به D انتسابش کرد؟ مرض Void چیه؟
در ضمن میدونم راه حلش اینه که return * this بزارم ولی مورد این چیه؟