I have used IT++ for half a year, which is a C++ liabrary.
Recently, I got a problem when I try to write the HEADER file for a class,
with a member which is another class object.

Here is part of my code:

class A
        fixvec fv;

fixvec is defined in IT++, actually is renamed from Vec<Fix>
by typedef. fixvec means an array of Fix type data. Vec<> is a more powerful vector template in IT++.
While Fix is a class defined in IT++, to do the fixed-point operation.

When u declare a fixvec object, it only accept parameters like

( int vec_length, fix_factory = DEFAULT_FAC);


Look back to my previous class definition. I want to define fv with any parameter I want, not only the DEFAULT_FAC.

The PROBLEM is in class definition, no parameters is allowed.

class A
  fixvec fv( length, fix_fac );

this cant work;

The only way seems to be my definition.

fixvec fv;

Then the default constructor of fixvec will be called, fv will be always with DEFAULT_FAC.

Could anybody help me, please?

I tried static, it can solve this problem, but still not flexible,
neither convenient.

Hope I explained clearly to u guys.
Below is the link for IT++ documentation of Fix and fixvec. u can get more.

7 Years
Discussion Span
Last Post by TurboCoding

Thanks a lot !It works correctly!
Never thought of the initialization list, so foolish.
Always tried to do this in the constructor body.

Thanks again!:)

Edited by TurboCoding: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.