title: A pointer to a bound function may only be used to call the function
body: <p>I'm working on a homework assignment for my <em>C++</em> class and have ran across a problem that I cannot figure out what I am doing wrong.</p>
  
  <p>Just to note,  the separation of the files is necessary and I realize this would be much easier if I just made a structure <code>AttackStyles</code> inside the <code>main</code> and forgo the additional class file altogether.</p>
  
  <p>The base of my problem is that I cannot seem to be able to loop through an array of classes and pull out base data.  Here is the code:</p>
  
  <pre><code>// AttackStyles.h
  #ifndef ATTACKSTYLES_H
  #define ATTACKSTYLES_H
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  class AttackStyles
  {
  private:
      int styleId;
      string styleName;
  
  public:
      // Constructors
      AttackStyles();  // default
      AttackStyles(int, string);
  
      // Destructor
      ~AttackStyles();
  
      // Mutators
      void setStyleId(int);
      void setStyleName(string);  
  
      // Accessors
      int getStyleId();
      string getStyleName();  
  
      // Functions
  
  };
  #endif
  
  
  /////////////////////////////////////////////////////////
  // AttackStyles.cpp
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "AttackStyles.h"
  using namespace std;
  
  
  // Default Constructor
  AttackStyles::AttackStyles()    
  {}
  
  // Overloaded Constructor
  AttackStyles::AttackStyles(int i, string n)
  {
      setStyleId(i);
      setStyleName(n);
  }
  
  // Destructor
  AttackStyles::~AttackStyles()    
  {}
  
  // Mutator
  void AttackStyles::setStyleId(int i)
  {
      styleId = i;
  }
  
  void AttackStyles::setStyleName(string n)
  {
      styleName = n;
  }
  
  // Accessors
  int AttackStyles::getStyleId()
  {
      return styleId;
  }
  
  string AttackStyles::getStyleName()
  {
      return styleName;
  }
  
  
  //////////////////////////////////////////////
  // main.cpp
  #include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "attackStyles.h"
  
  using namespace std;
  
  int main()
  {
      const int STYLE_COUNT = 3;
      AttackStyles asa[STYLE_COUNT] = {AttackStyles(1, "First"), 
                                       AttackStyles(2, "Second"), 
                                       AttackStyles(3, "Third")};
  
      // Pointer for the array
      AttackStyles *ptrAsa = asa;
  
      for (int i = 0; i &lt;= 2; i++)
      {
          cout &lt;&lt; "Style Id:\t" &lt;&lt; ptrAsa-&gt;getStyleId &lt;&lt; endl;
          cout &lt;&lt; "Style Name:\t" &lt;&lt; ptrAsa-&gt;getStyleName &lt;&lt; endl;
          ptrAsa++;
      }
  
      system("PAUSE");
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>My question is why do I get the error:</p>
  
  <pre><code>  "a pointer to a bound function may only be used to call the function"
  </code></pre>
  
  <p>on both <code>ptrAsa-&gt;getStyleId</code> and <code>ptrAsa-&gt;getStyleName</code>?</p>
  
  <p>I cannot figure out what is wrong with this!</p>