默认值构造函数错误:'foo'不是'foo'的直接基础

时间:2013-06-14 17:47:22

标签: c++ constructor default-value default-constructor

我试图设置一些默认构造函数,但一直遇到错误:

newton.h:29:38: error: type ‘Newton’ is not a direct base of ‘Newton’

我无法理解我做错了什么,我使用的是带有std = c ++ 0x的g ++(c ++ 11编译器设置)。

Newton.h:

#ifndef Newton_h
#define Newton_h

#include <armadillo>
#include "qr.h"

using namespace std;
using namespace arma;

class Newton {
 public:

  class Lambda {
  public:
    virtual double walkLambda(Newton newt) {};
  };

  class linearL : public Lambda {
  public:
    double walkLambda(Newton newt);
  };

  Newton(function<vec(vec)> f,
     vec xStart, vec dx,
     const double eps, function<mat(vec)> dfdx = 0, Lambda lambda = linearL());

  Newton(function<vec(vec)> f,
     vec xStart, vec dx,
     const double eps, Lambda lambda) : Newton(f, xStart, dx, eps, 0, lambda) {} // Line 29!

  vec getRoots();
  int getCalls();

 protected:
  int _n, _calls;
  vec _x, _dx, _y, _fx, _fy, _df;
  mat _j;
  function<vec(vec)> _f;
};
#endif

感谢您的时间。 最好的。

0 个答案:

没有答案