Constructor for struct in C++

in Leetcode questions, The tree node in C++ is defined as following:

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */

How is the constructor TreeNode(int x) implemented???

Comments (0)