中文版本 | English
A structured, lab-based introduction to C++ Object-Oriented Programming — from header files through templates, RAII, move semantics, and the STL. Each lab is a self-contained mini-project with skeleton code, test-driven grading, and incrementally introduced concepts.
| Lab | Topic | Key Concepts |
|---|---|---|
| 00 | Environment Setup | Headers, multi-file compilation, basic functions |
| 01 | Classes & Objects | public/private, constructors, const members |
| 02 | Constructors & Destructors | Rule of Three, deep copy, dynamic memory |
| 03 | Operator Overloading | Arithmetic, comparison, stream, conversion operators |
| 04 | Inheritance | protected, virtual functions, override |
| 05 | Polymorphism | Pure virtual, abstract base, unique_ptr |
| 06 | Templates | Class/function templates, specialization |
| 07 | RAII & Smart Pointers | unique_ptr, shared_ptr, weak_ptr, = delete |
| 08 | Move Semantics | Rvalue refs, std::move, noexcept, perfect forwarding |
| 09 | STL + OOP | std::map, algorithms, lambdas, nth_element |
| 10 | Capstone | Multi-class system, shared ownership, CLI |
- Compiler: g++ or clang++ with C++17 support
- Build system: None — direct
g++commands
Each lab has a test.cpp (auto-grader) and implementation files. Compile and run from the lab directory:
# Example: lab03
cd lab03
g++ -std=c++17 -Wall -Wextra test.cpp rational.cpp -o test && ./testLab 06 is header-only (no .cpp files):
cd lab06
g++ -std=c++17 -Wall -Wextra test.cpp -o test && ./testSee GRADER.md for the full command table.
lab00/ Environment setup (gcd, factorial)
lab01/ Classes and objects (Student grade tracker)
lab02/ Rule of Three (DynArray)
lab03/ Operator overloading (Rational numbers)
lab04/ Inheritance (Shape hierarchy)
lab05/ Polymorphism (Animal zoo simulator)
lab06/ Templates (Stack<T>, generic algorithms)
lab07/ RAII (FileGuard, ResourceCache)
lab08/ Move semantics (Buffer)
lab09/ STL (Inventory management)
lab10/ Capstone (Course registration system)
Based on the full learning plan. Progress through labs 00–10 in order — each builds on the last. Every main.cpp in each lab is the specification; test.cpp is the grader. Run the test after implementing to verify correctness.
After completing the labs:
- Exception safety guarantees (basic, strong, no-throw)
- Design patterns (Singleton, Factory, Observer, Strategy)
- Concurrency (
std::thread,std::mutex,std::async) - Build systems (CMake)
- Testing frameworks (Google Test, Catch2)