Michael Loceff's Modules
These modules were originally written by Michael. This is my snapshot from several quarters ago. Just like C++ itself, most of the material is still relevant and provided for easy reference here.
The most recent version of these modules could be found in many places online. I found a copy at our CS Club site, which may be about the same version as mine. These are for your benefit only. I only fix the odd serious typos.
Almost every topic we cover in CS2B can be found in Michael's material. Once you locate what you want, simply bookmark it in your browser. I left the Week numbers in the module headings intact. They are an approximate map to the sequence in which we cover topics in the course. But they are not exactly 1-1. So exercise your good judgement in deciding what to read when.
Happy Hacking,
&
Week 1A - Enums, Strings, Default Parameters
- Welcome
- Reading
- A Game of Cards
- Enums
- Default Parameters and Signatures
- Varieties of Strings
- More S-C String Functions
- The Card Class
Week 1B Review and Analysis of an OOP Project
- Static Member Data
- Static Class Methods
- The THIS Pointer
- Knowledge Check
- Analysis of an OOP Project
- Completion of the OOP Project
- Formatting Numbers on the Console
Week 2A - Pointers, Addresses, Memory
- Introduction and Resources
- Addresses
- Pointers
- Dynamic Memory Allocation
- Classes and Dynamic Allocation
- ArrayNames and Pointers
- Dynamic Arrays
Week 2B - Sorting, Recursion and Binary Search
- Linear Searching
- Recursion
- Binary Searching
- Review of Sorting
- Complete Binary Search Program
- A Puzzle
- External Url
- String to Number Conversions
Week 3A - Cellular Automata, Life and Binary Ops
- Introduction and Resources
- The Game of Life
- Binary and Hex
- Bit Operations
- Cellular Automata
- Implementing M. Mitchell Rules
- CStrings Revealed
- Passing Addresses (Pointers) to Methods
Week 3B - Multi-Dimensional Arrays and Stacks
- Dynamic Allocation of 2-D Arrays
- Stack vs. Heap Memory
- Deep Memory Galaxies
- Destructors and Copy Constructors
- The Full Galaxy Program
- Array-Based Stacks
- Multi-File Projects
Week 4A - Introduction to Inheritance
- Introduction to Inheritance: Base Classes
- Derived Classes, Function Chaining and Constructors
- Building Blocks of A Dynamic Stack
- The Stack Class
- The Complete Listing in Multiple Files
Week 4B - Implementing Inheritance
Week 5A - Operator Overloading
- Implications of Constructor Overloading
- Friends
- Operator Overloading
- Rational Numbers
- Overloading Insertion and Assignment Ops
- Operators and Inheritance
Week 5B - Exceptions
- Guarded Code
- Handling C++ Exceptions
- Throwing Exceptions and Nested Classes
- Catching Custom Exceptions
- Exceptions - Full Listing
Week 6A - Polymorphism and Virtual Functions
Week 6B - Deep Copies and 2D Barcode Readers
- Deep Copies of Images
- Optical Barcodes (Optional)
- Implementing a Pseudo-Datamatrix Optical Writer/Reader (Optional)
- A Pseudo-Datamatrix Class (Optional)
- Boolean Functions
- Circuit Complexity
- The Seven Segment Display
Week 7A - The Linked List ADT
- Introduction to Linked Lists
- A Base List Class
- Deriving a Float Class
- A Full List of Floats
- FloatList Source Code and Run
Week 7B - The Standard Template Library and Container Templates
- Introduction to Vectors and Other Containers
- Iterators
- Returning to Cards
- Improving Deck with vector
- STL Stacks and Queues
- STL lists (and a Sort Key Trick)
Week 8A - Templates We Define
- Writing Our Own Templates
- Templatizing the Class
- Applying the Template to Other Types
- Deeper Into Class Templates
- Function Templates
Week 8B - More Templates and an Advanced Const Primer
- A Constant Cause of Compiler Errors
- Template Instantiation, Parameters and Static
- Constructing Templates by Subclassing from STL Containers
- A Brief Introduction to Algorithms
Week 9A - The Tree ADT
- Introducing General Trees
- Implementing a General Tree
- Analysis of Recursive Tree Methods
- Traversals and Functors
- Deep Copies, Copy Constructors and Assignment
- The Complete Tree Listing
Week 9B - I/O with Files and Streams
Week 10A - Multiple Inheritance
- Introduction to Multiple Inheritance
- Not So Simple Multiple Inheritance
- Two Base Class Examples
- Multiple Inheritance in Practice
- Full Program Listing