mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-10-28 19:04:45 +08:00
- const README: rewrite the space-saving claim per issue #5 follow-ups (constant-expression const vs #define immediates; which const qualify as constant expressions) - const README: fix the class-section diagnosis per issue #338 (overload resolution picks the const overload; the restriction only surfaces once that overload is removed) - sizeof README: virtual-inheritance result is compiler-dependent (GCC merges vbptr+vfptr -> 16, MSVC keeps them separate -> 32) #246 - static README: new section on internal linkage / access restriction with anonymous-namespace comparison #142 - 10-day practice: full problem list table + fixed day links #136 - new design_pattern/singleton/singleton_default.hpp: reusable thread-safe CRTP singleton template, compile+concurrency tested #303
本文档由 C++那些事网站 同步生成,网站版本含多语言与更新排版。
C++ 十日速成练习
基本c++语法
递归、结构体、枚举、静态变量等
函数
函数深入
继承多态
虚函数、抽象类
运算符重载
模板与STL
异常
文件与流
每日题目说明(回应 issue #136)
题目即每天的文件名 + 文件内注释,这里给出汇总清单,练习时先看题目名,自己写一遍,再对照仓库实现:
| Day | 主题 | 题目(对应仓库文件) |
|---|---|---|
| 1 | 基本语法 | 注释对齐(annotate)、打印输出(print)、闰年判断(runnian)、union 初探(union) |
| 2 | 递归/结构体/枚举 | 汉诺塔(hanoi)、幂运算(pow)、递归基础(rec1)、简单计算器(compute)、枚举应用(enum) |
| 3 | 函数 | 函数重载、默认参数、值/引用/指针传参对比 |
| 4 | 函数深入 | 函数指针、回调、可变参数、内联函数 |
| 5 | 类与对象 | 构造/析构(ctor_dtor)、继承访问控制(inherit_access)、运算符重载(rule)、组合关系(rela)、虚函数初探(virtual) |
| 6 | 继承多态 | 虚函数、抽象类、纯虚函数、多态综合案例 |
| 7 | 运算符重载 | 算术/关系/下标/圆括号重载、强制转换运算符 |
| 8 | 模板与 STL | 类模板(class_template)、函数模板(func)、STL 容器入门(stl) |
| 9 | 异常 | try/catch、自定义异常、异常安全 |
| 10 | 文件与流 | 文件读写、流的格式化 |
建议:每道题先自己从零写,写不出来再看实现;写完了对比差距,收获最大(参考 issue #180 的讨论)。