/*
CS371p: Quiz #22 (5 pts)
*/
/* -----------------------------------------------------------------------
1. What is the output of the following program?
You must get the newlines right to get full credit.
Write the word "blank" to indicate a blank line.
(4 pts)
A()
A(A)
A(A)
=(A)
A(A) ~A()
blank
~A() ~A() ~A()
*/
#include <iostream> // cout, endl
using namespace std;
struct A {
A () {
cout << "A() ";}
A (const A&) {
cout << "A(A) ";}
~A () {
cout << "~A() ";}
A& operator = (const A&) {
cout << "=(A) ";
return *this;}};
void f (A)
{}
void g (A&)
{}
int main () {
{
A x;
cout << endl;
A y(x);
cout << endl;
A z = x;
cout << endl;
z = x;
cout << endl;
f(x);
cout << endl;
g(x);
cout << endl;
}
cout << endl;
return 0;}
syntax highlighted by Code2HTML, v. 0.9.1