In-Class Examples for CISC-2000-E01

  1. Install C++ on Macintosh. Not required for this course.
  2. Pointers
    1. Binary (base 2) and hexadecimal (base 16) notation for a whole number
    2. A pointer is a variable that contains the address of another variable.
    3. Linux commands.
  3. Dynamic memory allocation with the operators new and delete.
    1. Allocate an array with an unpredictable number of elements.
    2. Allocate an unpredictable number of variables.
  4. Preprocessor implements directives such as
    1. #include
    2. #define
    3. #ifndef needed for writing a header (.h) file for a class
  5. Classes.
    1. The components of a class
      1. data members vs. member functions
      2. public members vs. private members
      3. constructors vs. destructor
      4. header (.h) file and implementation (.C) file
      5. static members and friend functions
    2. Now that the data members are private, we can re-implement a class (class date) in different ways without disturbing the rest of the program.
      1. Class date with two non-static data members
      2. Class date with one non-static data member
    3. Use an object to trigger a pair of events: class announcer.
    4. More examples: class point, class stack, class myrandom.
  6. Midterm review.
  7. Midterm.
  8. Operator overloading.
    1. Operators that use the value of an existing object: ==
    2. Operators that change the value of an existing object: +=
    3. Operators that create and return a new object: binary +
    4. Operators that perform input and output, and return a stream: << >>
    5. An operator for an object that does only one job: ()
  9. Inheritance and polymorphism.
    1. Single inheritance and polymorphism
    2. Multiple inheritance and virtual base classes
    3. Abstract base classes and pure virtual functions
    4. Public inheritance vs. private inheritance
  10. Templates.
    1. Template functions
    2. Template classes