Menu

C

0 Comment

in C please see the attachment to check the main instruction for this assignment.Operator overloading Q/AQ: This is from the lecture but I don’t really understand what’s going on here:Date d4;//laterd4 = d1;A: Here we can do direct assignment if we overloaded the assignment operator for the DateQ: Assignment or copy constructor?A:Date d1;Date d2 = d1;//this is a copy constructor. The same as if I said:Date d2(d1);//this is assignment:Date d1, d2;////laterd1 = d2;Q: “But what do I add? Days? Months? Years? There is some ambiguity here. Not to overload. “Wouldn’t it do all of them?A: If I have:Date d;……d = d 5;Is it clear what do I add to that date d?Q: Why is that istream and ostream?A: in one case you enable the direct input to the Date, in other case you enable direct output. So you can:Date d;cin<