Debugging question 2

The following code causes some compilation errors. Find them and correct them.
// this code contains errors
#include <iotsream>

class A {
  A() {
    std::cout << "constructing object of class A" << std::endl;
  }
  ~A() {
    std::cout << "destroying object of class A" << std::endl;
  }
  setDatum(int i) {
    theDatum = i;
  }
  getDatum(void) {
    return theDatum;
  }
private:
  int theDatum;
}

int main(int argc, char** argv) {
  A a;
  a.SetDatum(5);
  std::cout << a.GetDatum() << std::endl;
  return;
}
What is the corrected program output when executed with \fbox{\tt ./debug2} ?



Subsections

Leo Liberti 2008-01-12