/*
CS371p: Quiz #10 (5 pts)
*/

/* -----------------------------------------------------------------------
1. Describe the difference in binding time between overloading and
   overriding.
   [Sec. 15.0, Pg. 287]
   (1 pt)

compile time vs. run time
*/

/* -----------------------------------------------------------------------
2. What is the output of the following blocks?
   Alternatively, the blocks might not compile.
   If a block doesn't compile, which line is illegal.
   (3 pts)

doesn't compile
0 0
doesn't compile
*/

#include <iostream> // cout, endl

int main () {
    using namespace std;

          int i  = 2;
    const int ci = 3;

    {
    typedef const int* pointer;
    pointer  p = &i;
    pointer& r = p;
//  *r = 0;                     // error: assignment of read-only location
//  cout << i << " ";
//  cout << p << endl;
    }

    {
    typedef const int* pointer;
    pointer  p = &ci;
    pointer& r = p;
    r = 0;
    cout << p << " ";
    cout << r << endl;
    }

    {
    typedef int* pointer;
          pointer  p = &i;
    const pointer& r = p;
//  r = 0;                      // error: assignment of read-only reference 'r'
//  cout << p << " ";
//  cout << r << endl;
    }

    return 0;}


syntax highlighted by Code2HTML, v. 0.9.1