title: Visual 2010 keeps telling me "error: Expression must have class type"
body: <p>Okay I need some insight.</p>
  
  <p>I am taking a C++ class and am working on my second project. I am trying to create a list of options that allow you to store emails in a string vector. </p>
  
  <p>Now before taking the time to help me and look at the code I want to point out my problem. I made an object in the file "HughesProject2-1.cpp":</p>
  
  <pre><code>HughesEmail myhughesEmail();
  </code></pre>
  
  <p>Well the problem comes right after this when I used this object to run displayList():</p>
  
  <pre><code>myHughesEmail.displayList();
  </code></pre>
  
  <p>Visual 2010 keeps telling me "error: Expression must have class type"</p>
  
  <p>Now I am using the book as a reference to doing this and they created an object the same way and used it the same way right after. I am confused at what I have wrong as my file is quite different past the basics of using the objects and what is being done. I understand there my be other errors as this is incomplete and I'm still learning, I need to know what is most likely causing me from using the object after I made it. Thanks in advance.</p>
  
  <p><em><strong>I have three files:</em></strong></p>
  
  <p>HughesEmail.cpp</p>
  
  <pre><code>// Classes for HughesProject2-1.cpp and HughesEmail.h
  
  // Includes
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;iomanip&gt;
  #include "HughesEmail.h"
  
  // Namespaces
  using namespace std;
  
  // Initializing Constructor
  HughesEmail::HughesEmail()
  {
      vector&lt; string &gt; emailStorage( 100 );
      emailMinimumLength = 9;
      exitOption = 1;
      emailOption = 1;
  }
  
  void HughesEmail::displayList()
  {
      // Check if exit is set, if not run.
      if ( exitOption == 1 )
      {
      // Email list options
      cout &lt;&lt; "Choose from the list of options: \n"
          "1 - Store an email address.\n"
          "2 - Search an email address.\n"
          "3 - List all email adresses.\n"
          "4 - Delete an email address.\n"
          "0 - Exit.\n" &lt;&lt; endl;
  
      while ( emailOption != 0 )
      {
          // Get user input for email list option
          cout &lt;&lt; "Option? : ";
          cin &gt;&gt; option;
  
          switch ( option )
          {
          case '0':
              // set exitOption to 0
              exitOption = 0;
              emailOption = 0;
              break;
          case '1':
              //Input email name
              cout &lt;&lt; "Please input email to be stored: " &lt;&lt; endl;
              cin &gt;&gt; emailName;
              // run storeEmail
              storeEmail( emailName );
              break;
          case '2':
              // run searchEmail
  
              break;
          case '3':
              // run listEmail
  
              break;
          case '4':
              // run deleteEmail
  
              break;
  
          //Ignore
          case '\n':
          case '\t':
          case ' ':
              break;
  
          default:
              cout &lt;&lt; "\nPlease choose a valid option." &lt;&lt; endl;
              break;
          } // end switch
  
      } // end while
  
      } else {
  
          exitOption = 0;
  
      } // end else
  }
  
  
  void HughesEmail::storeEmail( string emailName )
  {
      // Initialize counter
      int i;
      i = 0;
  
      // Check if input emailName meets emailMinimumLength
      if( emailName.length() &gt;= emailMinimumLength )
      {
  
        // if email in vector slot i is less than minimum length, then override with new email.
        if ( emailStorage[ i ].length() &lt; emailMinimumLength )
        {
            emailStorage[ i ] = emailName;
        } else {
            i++;
        } // end else
  
      } else {
          cout &lt;&lt; "Email does not meet the minimum length of: " &lt;&lt; emailMinimumLength &lt;&lt; " characters." &lt;&lt; endl;
      } // end else
  }
  </code></pre>
  
  <p>HughesEmail.h</p>
  
  <pre><code> // In this project: HughesProject2.h
      // Class header file.
  
      //Includes
      #include &lt;string&gt;
      #include &lt;iostream&gt;
      #include &lt;vector&gt;
  
      //Namespaces
      using namespace std;
  
      class HughesEmail
      {
      public:
          HughesEmail();
          void displayList();
          void storeEmail( string );
          string searchEmail( string );
          string listEmail();
          void deleteEmail();
      private:
          vector&lt; string &gt; emailStorage;
          int emailMinimumLength;
          int emailOption;
          int exitOption;
          char option;
          string emailName;
      };
  </code></pre>
  
  <p>HughesProject2-1.cpp</p>
  
  <pre><code>// In this project: HughesProject2-1.cpp
  // Class creation to store email adresses. Adding, deleting, searching and listing email addresses.
  
  // Includes
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include "HughesEmail.h"
  
  // Namespaces
  using namespace std;
  
  int main()
  {
      //Create HughesEmail Object
      HughesEmail myHughesEmail();
      myHughesEmail.displayList();
  
  }
  </code></pre>