How to get/set values in a private struct in c++? -


i'm having little problem setting values in private struct of class. following:

//processimage.h  class process_image {      private:        struct imagedata        {          mat imagematrix;          int v_min;          int v_max;           imagedata(mat img, int vmin=0, int vmax=255):                imagematrix(img), v_min(vmin), v_max(vmax) {}       };      public:       bool set_v_min(int value); };   //processimage.cpp  bool process_image::set_v_min(int value) {      if(value>0&&value<256)      {      imagedata.v_min=value; //it not working setting      return true;      }  return false;  } 

where wrong? think should possible set value in struct way don't know i'm missing. please give me hint or direction how right way.

you haven't created structure yet, described it. have constant structure inside class write down this:

class process_image {      private:        struct imagedata        {          mat imagematrix;          int v_min;          int v_max;           imagedata(mat img, int vmin=0, int vmax=255):                imagematrix(img), v_min(vmin), v_max(vmax) {}        }imagedata; // <- missing part      public:       bool set_v_min(int value); }; 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -