mardi 31 octobre 2017

constructor errors in C++

Hello I am a beginner level C++ coder, still learning the basics of the programming language. I wrote the following code -

using namespace std;
namespace eLib
{
  class errorValue
  {
    public:
      errorValue(ErrorCode value, string text, int sec):
      {
        value_(value),
        text_(text),
        is_armed_(false),
        sec_(sec)
      ;}
    private:
      ErrorCode value_;
      string text_;
      bool is_armed_;
      int sec_;
  };
}

I get the following errors which I am not able to understand -

  1. following expressions cannot be used as a function

    value_(value),
    error_text_(error_text),
    is_armed_(false),
    retry_seconds_(retry_seconds)
    
    
  2. expected identifier before '{' token in Line 8

This might be a noob question but I am stuck and any help will be really appreciated. TIA

Aucun commentaire:

Enregistrer un commentaire