2010/5/11 fmingu <fmingu@163.com>
.................................class TransferedSignal{
public:
TransferedSignal(){
one(0.0,1.0) ;
die(rng, one);
};
Try replacing your constructor with this:
TransferedSignal() : one(0.0,1.0), die(rng, one) {}
Roman Perepelitsa.
Oh,It works now. But can you tell me the reason about it? Is that a kind of C++ standard to do so? And when I wrote another programs like:#include <boost/numeric/mtl/mtl.hpp>
using namespace mtl; using namespace mtl::matrix;typedef dense2D<double> Matrix;
typedef dense_vector<double> Vec;class Used{
public:
Used(){};
Used(Matrix inputmatrix, Vec inputvec):matrix(inputmatrix),vec(inputvec),value(111){};
Matrix getmatrix(){ return matrix;};
Vec getvec(){return vec;};
int getvalue(){return value;};
protected:
Matrix matrix;
Vec vec;
int value;
};class Usedchild:public Used{
public:
Usedchild(Matrix inputmatrix, Vec inputvec):matrix(inputmatrix),vec(inputvec){};}
the gcc complier told me that:
mainprojectme9.cpp: In constructor 'Usedchild::Usedchild(Matrix, Vec)':
mainprojectme9.cpp:92: error: class 'Usedchild' does not have any field named 'matrix'
mainprojectme9.cpp:92: error: class 'Usedchild' does not have any field named 'vec'Can anyone tell me why?
Thanks a lot.