浏览 200 次
|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (1) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
时间:2008-03-24 关键字: static
1> A static data member can be of the same class type as that of which it is a member. a nonstatic data member is restricted to being decleared as a pointer or a reference to an object of its class.
class Bar{
private:
static Bar mem1; //ok
Bar *mem2; //ok
Bar mem3; //error
}
2> static成员变量能够作为当前class的成员函数的默认参数,但是non-static则不可以 3>对于static成员函数的声明和定义,在class 中声明时要标注static关键字,而在class外部定义时,一定不要写static. 4>static 函数中要注意什么?
声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
| 返回顶楼 | |


