November 2001
Beginner
1128 pages
29h 12m
English
| 1: | Use a member function to overload the multiplication operator for the Stonewt class; have the operator multiply the data members by a type double value. Note that this will require carryover for the stone-pound representation. That is, twice 10 stone 8 pounds is 21 stone 2 pounds. |
| A1: | Here's a prototype for the class definition file and a function definition for the methods file:
// prototype
Stonewt operator*(double mult);
// definition -- let constructor do the work
Stonewt Stonewt::operator*(double mult)
{
return Stonewt(mult * pounds);
}
|
| 2: | What are the differences between a friend function and a member function? |
| A2: | A member function is part of a class definition and is invoked by a particular object. The member function can ... |
Read now
Unlock full access