Why, in C++, is my class constructor described by Visual Studio as having "2+ Overloads"?

Viewed 121

I have a TreeNode class with a constructor that sets the value of the node, and sets the left and right pointers to null.

class TreeNode {
 public:
  int val = 0;
  TreeNode *left;
  TreeNode *right;

  TreeNode(int x) {
    this->val = x;
    left = right = nullptr;
  }
};

When I hover my mouse over TreeNode(int x) I get a message that states:

TreeNode::TreeNode(int x)

+2 overloads

What does 'overloads' mean in this context? From what I understand, overloading would occur if I, for example, had an additional function within the TreeNode class also named TreeNode().

Thanks for any explanation!

1 Answers

Your class TreeNode has implicit auto-generated copy/move constructors.

Those should be the overload pointed by intellisense.

Related