title: Why is Wizard wiz0; not equivalent to Wizard wiz0(); in my code? C2228 Error
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2318650/is-no-parentheses-on-a-constructor-with-no-arguments-a-language-standard">Is no parentheses on a constructor with no arguments a language standard?</a>  </p>
  </blockquote>
  
  
  
  <p>Okay, I've got a pickle. It's an error C2228 issue, and I've looked at other questions and answers, and none of the tips given seem to work for me- this is my first question, and I'm a newbie, so please be gentle! Note: The program WILL compile if I use </p>
  
  <pre><code>Wizard wiz0; 
  </code></pre>
  
  <p>but NOT if I use</p>
  
  <pre><code>Wizard wiz0();
  </code></pre>
  
  <p>The book I am using tells me that these two statements should be equivalent, so I am trying to figure out why I can use one and not the other.</p>
  
  <p>First off, here is the error when I attempt to use Wizard wiz0():</p>
  
  <pre><code>1&gt;  Chapter5.cpp
  1&gt;Chapter5.cpp(14): error C2228: left of '.fight' must have class/struct/union
  1&gt;Chapter5.cpp(15): error C2228: left of '.talk' must have class/struct/union
  1&gt;Chapter5.cpp(17): error C2228: left of '.setArmor' must have class/struct/union
  1&gt;Chapter5.cpp(19): error C2228: left of '.getName' must have class/struct/union
  1&gt;Chapter5.cpp(21): error C2228: left of '.castSpell' must have class/struct/union
  </code></pre>
  
  <p>Here is (what I think) the relevant code from Chapter5.cpp is:</p>
  
  <pre><code>Wizard wiz0(); //declares a variable (wiz0) of type Wizard.
  
  wiz0.fight();
  wiz0.talk();
  
  wiz0.setArmor(10);
  
  cout &lt;&lt; "Player's Name: " &lt;&lt; wiz0.getName() &lt;&lt; endl;
  
  wiz0.castSpell();
  </code></pre>
  
  <p>Also, here is the information from wiz.h file:</p>
  
  <pre><code>public
  //Constructor
  Wizard();
  
  //Overloaded Constructor
  Wizard(std::string name, int hp, int mp, int armor);
  
  //Destructor
  ~Wizard();
  
  //Methods
  void fight();
  void talk();
  void castSpell();
  void setArmor(int mArmor);
  std::string Wizard::getName();
  
  private:
  //Data members
  std::string mName;
  int mHitPoints;
  int mMagicPoints;
  int mArmor;
  </code></pre>
  
  <p>...and finally, information from the wiz.cpp file!</p>
  
  <pre><code>//Wiz.cpp implementation file
  
  #include "stdAfx.h"
  #include "wiz.h"
  using namespace std;
  
  //The Constructor call
  Wizard::Wizard()
  {
  /*If the client calls a constructor without
  specifying values, these will be the default
  values that the program will use */
  mName = "DefaultName";
  mHitPoints = 1;
  mMagicPoints = 1;
  mArmor = 0;
  }
  
  Wizard::Wizard(std::string name, int hp, int mp, int armor)
  {
  //Client called constructor WITH values, so create an
  //object with them.
  mName = name;
  mHitPoints = hp;
  mMagicPoints = mp;
  mArmor = armor;
  }
  
  void Wizard::fight()
  {
      cout &lt;&lt; "Fighting." &lt;&lt; endl;
  }
  
  void Wizard::talk()
  {
      cout &lt;&lt; "Talking." &lt;&lt; endl;
  }
  
  void Wizard::castSpell()
  {
      if (mMagicPoints &lt; 4)
          cout &lt;&lt; "Casting spell." &lt;&lt; endl;
      else
          cout &lt;&lt; "Not enough MP!" &lt;&lt; endl;
  }
  
  void Wizard::setArmor(int armor)
  {
      if(armor &gt;= 0)
          mArmor = armor;
  } 
  
  std::string Wizard::getName()
  {
  return mName;
  }
  
  Wizard::~Wizard()
  {
  //Not using dynamic memory- nothing to clean
  }
  </code></pre>
  
  <p>Phew... I think that's everything. If you guys can figure out what it is I'm doing wrong, I'd greatly appreciate it!</p>