C++,非公有成员都包括什么?
天蓬老师
天蓬老师 2017-04-17 15:01:33
0
2
545

protected+private还是只有private?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
大家讲道理

protected and private. Constructors and destructors, as well as static member functions and friend member functions (rarely used) can be protected or even private.
Private constructors do not allow external objects to be constructed directly, while classes can provide specialized factory methods or singleton methods to construct objects.

黄舟

The members of the C++ class include these:

  1. 构造和析构(Public by default, not public, how to create and destroy it?)

  2. The methods and variables described by
  3. public are shared. (Can be called externally)

  4. The methods and variables described by protect are protected. (Not callable from outside)

  5. private Described methods and variables, private (not callable from outside)

  6. The methods and variables described by
  7. static do not belong to any object, but belong to the entire class. The calling method is 类名::方法|变量

  8. friend describes methods and variables, commonly used friend functions. In order to make member functions of other classes access the private members of the class.

Basically these. I think the non-public properties of C++ should be except for public, that is, 3, 4, 5, 6.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template