百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

design-patterns-cpp

> 编程语言
开源

C++ 中的设计模式示例

385 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

C++ 中的设计模式示例

Design Patterns in C++

This repository is part of the Refactoring.Guru project.

It contains C++ examples for all classic GoF design patterns. Each pattern includes two examples:

  • Conceptual examples show the internal structure of patterns with detailed comments.
  • RealWorld examples show how the patterns can be used in a real-world C++ application.

Requirements

The examples were written as cross platform console application using c++17. It means that you should be able to compile and execute those examples with any recent compiler.

we recommend working with Visual Studio Code because it is a lightweight and cross-platform tool .It is a very complete IDE and is available for free (https://code.visualstudio.com/). You may need to install c++ extension and the compiler you prefer (The extension is still in preview and its focus is code editing, navigation, and debugging support for C and C++). For more information on how to use VSCode with c++ refer to: https://code.visualstudio.com/docs/languages/cpp .

For code execution in VSCode you will need to set up your task first. An example using g++ :

bash
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++ -g -std=c++17 Conceptual/main.cc -o main",
            "group":{
                "kind": "build",
                "isDefault": true    
            },
            "problemMatcher":"$gcc"
        }
    ]
}

Then you just need to start the executable. In case you have some doubts here you have an useful [tutorial] using vscode.

Contributor's Guide

I appreciate any help, whether it's a simple fix of a typo or a whole new example. Just make a fork, make your change and submit a pull request.

Here's a style guide which might help you to keep your changes consistent with the rest of the project's code:

  1. All code should match the Google style guide.
  2. Aim to put all code within one .cc file. Yes, I realize that it's not how it supposed to be done in production. However, it helps people to understand examples better, since all code fits into one screen.
  3. The comments doesn't follow the style guide for compatibility reasons with other language examples.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言