title: Invalid use of non static data member C++
body: <p>Here is my code </p>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "header.h"
  #include "source.cpp"
  
  using namespace std;
  
  int main()
  {
      cout &lt;&lt; "Hello world!" &lt;&lt; endl;
      int testarray[]={1,3,5,7};
      mymatrix* first=new mymatrix(testarray,2,2);
      return 0;
  }
  </code></pre>
  
  <p>and header.h</p>
  
  <pre><code>using namespace std;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  class mymatrix{
  public:
      int i;
      int j;
      int marray[];
  
      mymatrix(int m[],int rows,int cols ) : marray(m),i(rows),j(cols)
      {
          cout&lt;&lt;"this is for testings ";
      }
      mymatrix()
      {};
      ~mymatrix(){
      // delete[] marray;
      };
  
  
  };
  </code></pre>
  
  <p>I get this error :Invalid use of non static data member mymatrix::i </p>
  
  <p>what I wanna do is make a object of my
  matrix class and pass an array </p>