如果我有一个调用其他实例之一的重载函数,它是否被认为是一个递归函数?

Hay*_*den -4 c++ recursion constructor class function-calls

这是假设,但我有一个带有两个重载构造函数的类 - 其中没有一个是默认的构造函数.如果我从另一个调用一个构造函数,它会递归吗?例:

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

     Example(argument)
     {
          Example object(68);
          //Rest of constructor code
     }
};
Run Code Online (Sandbox Code Playgroud)

Rem*_*eau 5

没有

递归是函数调用自身时,而不是具有不同参数的同名重载函数.你所描述的根本不是递归.它是委托构造函数,这是C++ 11中引入的一个新特性.根据定义:"委托构造函数不能递归".