Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文版本 | English

CPP OOP Learning

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.

Concepts Covered

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

Prerequisites

  • Compiler: g++ or clang++ with C++17 support
  • Build system: None — direct g++ commands

Build & Run

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 && ./test

Lab 06 is header-only (no .cpp files):

cd lab06
g++ -std=c++17 -Wall -Wextra test.cpp -o test && ./test

See GRADER.md for the full command table.

Project Structure

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)

Learning Path

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.

What's Next

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)

About

使用Skeleton 框架,通过完成 TODO 来学习 C++ 面向对象相关语法与内容

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages