In this module we bridge some of the Object-Oriented ideas and Java constructs to C++. We cover the basics on how to build, link, and run C++ code, as well as show how C++ constructs interact with the memory model we developed during the semester for Java.

We then cover some of the correspondence between Java and C++ constructs through a series of examples. We conclude this module with an introduction to pointers and memory management in C++.

  1. Given a set of C++ source files, compile and run the program.
  2. Given an UML class diagram, translate the corresponding C++ classes.
  3. Given a C++ class and an operator, write the member function that overloads the operator.
  4. Given a structure definition in C++, implement a function that operates on a struct.
  5. Given a union definition in C++, implement a function that operates on a union.
  6. Given C++ code that uses pointers, draw a diagram to showing memory state on the stack and heap.
  7. Write a C++ program that calls a member function that uses pass by reference arguments.
  8. Explain what a destructor member function does in C++.
  9. Explain what a copy constructor member function does in C++.
  10. Given an operator, contrast operator overloading in C++ with method overloading in Java.