Homework 7
Assigned Week of Laboratory 9
Electronic Submission Due by 10AM, April 4
No Late Submissions Will Be Accepted For Any Reason
As We Are Posting The Answers Wednesday Morning
Pledge Requirements
You may on this pledged assignment work in groups. Your partners may be
from any lab section. However, each student is required to do his or her own
separate submission. Please indicate in your submission who you worked with. Your
group may discuss
the content of this assignment and your thoughts with anyone, but your group
must do all if its own work.
Purpose
To get you ready for next week's test.
Assignment
There have been three files created for your perusal.
- widget.h -- defines a class Widget and
prototypes some auxiliary stream operators
- widget.cpp -- implements the Widget member
functions the auxiliary stream operators.
- client.cpp -- uses the widget library
Please examine the files and determine the answers to the following
questions. Spend the time to get this assignment. It is not our intention for
you to run this code -- we want you to figure it out by you being the computer. It will help you on our test
and on our final. Create your answers as a text file. Submit the file
electronically under the name hw07.txt. Each answer will be worth 5 points.
- What type of Widget member is
- Widget(string objectID = "defaultID", string value =
"defaultValue");
- What type of Widget member is
- Widget(const Widget &source);
- What type of Widget member is
- What type of Widget member is
- What type of Widget member is
- void insert(ostream &sout) const;
- What type of Widget member is
- What output is produced by the following object definition from client.cpp?
- What output is produced by the following object definition from client.cpp?
- What output is produced by the following object definition from client.cpp?
- What output is produced by the following object definition from client.cpp?
- What output is produced by the following object definition from client.cpp?
- What output is produced by the following statement from client.cpp?
- What output is produced by the following statements from client.cpp?
- X.setValue("123");
cout << X << endl;
- What output is produced by the following statement from client.cpp given
that the next input string in standard input is xyz?
- Z.extract(cin);
cout << Z << endl;
- What output is produced by the following statement from client.cpp?
- Suppose that the comment in client.cpp was replaced with the
following statement. Would the program compile successfully? If so, what is
the output? If not, why doesn't it compile?
- Suppose that the comment in client.cpp was replaced with the
following statement. Would the program compile successfully? If so, what is
the output? If not, why doesn't it compile?
- Suppose that the comment in client.cpp was replaced with the
following statement. Would the program compile successfully? If so, what is
the output (if any)? If not, why doesn't it compile?
- Suppose that the comment in client.cpp was replaced with the
following statement. Would the program compile successfully? If so, what is
the output? If not, why doesn't it compile?
- Suppose that the comment in client.cpp was replaced with the
following statement. Would the program compile successfully? If so, what is
the output? If not, why doesn't it compile?
- cout << X.thisValue << endl;