Home:ALL Converter>How to implement a class with FIX types

How to implement a class with FIX types

Ask Time:2014-07-30T03:34:29         Author:e271p314

Json Formatter

Here is a working code

#include "quickfix/FixFields.h"
#include "quickfix/Values.h"

int main()
{
  FIX::BeginString beginString(FIX::BeginString_FIX42);
  return 0;
}

It compiles and if I print the value of beginString I get the expected result.

Now I want to implement a class with the same type

#include "quickfix/FixFields.h"
#include "quickfix/Values.h"

class A {
  FIX::BeginString beginString;
public:
  A()
  {
    beginString = FIX::BeginString_FIX42;
  }
};

int main()
{
  return 0;
}

This code does not compile, the compilation error is

test.cpp: In constructor ‘A::A()’:
test.cpp:9:17: error: no match for ‘operator=’ (operand types are ‘FIX::BeginString’ and ‘const char [8]’)
     beginString = FIX::BeginString_FIX42;
                 ^

Any idea what is wrong and how to fix it?

Author:e271p314,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25023527/how-to-implement-a-class-with-fix-types
rerun :

FIX::BeginString_FIX42 is a const i'm guessing. When you define a function which again I am guessing you want to do you need to specify a type of a value not a value. BeginString is a type BeginString_FIX42 is a constant that tells begin string which version of the begin to return. ",
2014-07-29T19:41:54
yy