Navigation Menu

Skip to content

Commit

Permalink
doc coding-style: add about copy constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Mar 15, 2012
1 parent bdc052a commit e1c194f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions doc/source/developer/coding_style.rst
Expand Up @@ -264,3 +264,32 @@ TODO: ちゃんと考える。
};
}

コピーコンストラクタ
--------------------

基本的にコピーコンストラクタの使用を禁止する。

よい例:

class MyClass
{
private:
MyClass(const MyClass &);
}

悪い例(コピーコンストラクタを禁止していない):

class MyClass
{
}

悪い例(カスタムコピーコンストラクタを使っている):

class MyClass
{
unsigned int age_;
MyClass(const MyClass &object)
{
this.age_ = object.age_;
}
}

0 comments on commit e1c194f

Please sign in to comment.