这是什么' : MAXKEY(), root() ',用于 c++ 类?

What is this ' : MAXKEY(), root() ' , used in class of c++?

本文关键字:c++ 用于 是什么 MAXKEY root      更新时间:2023-10-16

我正在学习c++中的数据结构,2-3树。

我想知道关于':MAXKEY(), root()'.

class Two3 {
public:
    Two3(KeyType max, Two3Node<KeyType>* init = 0)
        : MAXKEY(max), root(init) {}; //constructor
    Boolean function(…);
private:
    Two3Node<KeyType>* root;
    KeyType MAXKEY;

这就是我想知道的。

: MAXKEY(max), root(init) {};//构造函数

这是一个初始化列表。它说"用max初始化MAXKEY,用init初始化root"。