title: is it wrong to call a method outside main()
body: <p>I was wondering if someone could explain the meaning of the following error:</p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>    #include "sstream"
  
      std::stringstream h;
  
      h.str(""); //clearing the stringstream object
  
      int main()
  </code></pre>
  
  <p><strong>ERROR</strong></p>
  
  <blockquote>
    <p>kial.cpp:5:1: error: ‘h’ does not name a type  h.str("");</p>
  </blockquote>
  
  <p>Also why is it wrong to try to access the method ouside of the main()?</p>