C ++命名约定 [英] C++ Naming Convention

查看:123
本文介绍了C ++命名约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c ++的广泛接受的命名约定是什么? (函数,类,参数,局部变量,命名空间等)

What is the widely accepted naming convention for c++ ? (functions, classes, parameters, local variables, namespaces, etc)

推荐答案

我不认为有 C ++中的命名约定。 Stroustrup 的书籍和文件通常具有以下编码风格:

I don't think there is a "widely accepted" naming convention in C++. Stroustrup's books and papers generally has the following coding style:

class Shape {
public: // interface to users of Shapes
    virtual void draw() const;
    virtual void rotate(int degrees);
    // ...
protected:  // common data (for implementers of Shapes)
    Point center;
    Color col;
    // ...
};

您还可以查看受欢迎的样式指南,例如 Google C ++样式指南

You also may want to look at popular style guides like The Google C++ Style Guide.

这篇关于C ++命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆