Naming Conventions for Accessors

Posted 金庆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Naming Conventions for Accessors相关的知识,希望对你有一定的参考价值。

Naming Conventions for Accessors

from: http://cginternals.github.io/guidelines/articles/

When naming accessors within classes, non-trivial getters and queries, i.e., those that perform calculations, you should prepended get. All other getters have no prefix and setters have the set prefix.

class Object

public:
  int radius() const;
  void setRadius(int value);

  int getPerimeter();

private:
  int m_radius;
;

int Object::radius() const

    return m_radius;


void Object::setRadius(int value)

    m_radius = value;


int Object::getPerimeter()

    return 2 * pi * m_radius;

以上是关于Naming Conventions for Accessors的主要内容,如果未能解决你的问题,请参考以下文章

Naming Conventions for Accessors

C# Coding & Naming Conventions

which of the following naming conventions can be used with iscsi ?

Spring mvc 4系列教程——依赖管理(Dependency Management)和命名规范(Naming Conventions)

Rails多态命名边缘情况

spring mvc 500错误Allocate exception for servlet AppService javax.naming.NamingException: Cannot creat