-4

This is hypothetical, but I have a class with two, overloaded constructors - none of which are the default constructors. If I were to call one constructor from the other, would it be recursive? Example:

class Example
{
     Example(const int integer)
     {
          //Constructor Code Here
     }

     Example(argument)
     {
          Example object(68);
          //Rest of constructor code
     }
};
Hayden
  • 41
  • 7

1 Answers1

5

No

Recursion is when a function calls itself, not an overloaded function of the same name with different parameters. What you are describing is not recursion at all. It is delegating constructors, a new feature introduced in C++11. And by definition: "Delegating constructors cannot be recursive".

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770