title: (->) arrow operator and (.) dot operator , class pointer
body: <p>In C++ we know that for a pointer of class we use (<code>-&gt;</code>) arrow operator to access the members of that class like here:</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class myclass{
      private:
          int a,b;
      public:
          void setdata(int i,int j){
              a=i;
              b=j;
          }
  };
  
  int main() {
      myclass *p;
      p = new myclass;
      p-&gt;setdata(5,6);
      return 0;
  }
  </code></pre>
  <p>Then I create an array of <code>myclass</code>.</p>
  <pre><code>p=new myclass[10];
  </code></pre>
  <p>when I go to access <code>myclass</code> members through (<code>-&gt;</code>) arrow operator, I get the following error:</p>
  <pre><code>base operand of '-&gt;' has non-pointer type 'myclass'
  </code></pre>
  <p>but while I access class members through (<code>.</code>) operator, it works. These things make me confused. Why do I have to use the (<code>.</code>) operator for an array of class?</p>