CS 2124 — Object Oriented Programming

Syllabus and Lecture Notes

TOPICS
and NOTES

Key Subtopics
Sample Code on Website

Python to C++

Basic C++

  • Simple program
  • Loops
  • Conditions
  • File I/O
  • Vectors
  • Structs
  • Functions / parameter passing
  • Reading in a file
  • How NOT to read a file
  • Reading a file into a vector
  • Vector of objects that contain vectors
Classes
  • Member variables and functions
  • Constructors.
  • Const functions.
  • Separating the class definition from the member function definitions.
  • A simple Date Class
  • Composition and association
  • Dynamic array of pointers to objects.

Pointers

Composition and Association

  • address/location
  • pointer variables
  • address-of operator
  • dereferencing operator
  • pointer arithmetic
  • new/delete
  • Intro to addresses andpointers
Copy Control
Implementing the Vector
  • Destructor
  • copy constructor
  • assignment operator
  • Need for copy constructor.
  • Vector class.
Separate Compilation
Namespaces
Include Guards
Cyclic Association
  • header files and implementation files.
  • include guard: #ifndef, #define and, #endif
  • The class Date using separate compilation and a namespace.
Operator overloading
  • Why?
  • Operator expressions as function calls.
  • I/O operators
  • Comparison operators.
  • Friends
  • What you can / can't do with operator overloading.
  • Overloading operators for the Date class

Inheritance

  • Simple public inheritance.
  • Protected access.
  • Polymorphism.
  • Virtual mechanism and virtual methods.
  • Pure virtual methods and abstract classes.
  • Multiple Inheritance
  • Basic inheritance
  • Order of constructors and destructors.
  • Polymorphism
  • Abstract Classes
Linked Lists
  • Implement a toolkit for a singly linked list.
  • Linked List Toolkit
Recursion
  • Understanding recursive code
  • Writing recursive functions
  • Simple examples
  • Binary Search
  • Linked List toolkit using recursion.
STL - Standard Template Library
  • Containers (vector and list),
  • Iterators
  • Generic algorithms
  • Some examples using the STL vector and list.
Exceptions and Assertions    

Home


Maintained by John Sterling (john.sterling@nyu.edu).