title: Class/member function error
body: <p>I have this snippet of code here:</p>
  
  <pre><code>class physics_vector
  { 
  public:
      double direction, magnitude;
      int dir_mag(double dir, double mag) :direction(dir), 
          magnitude(dir) {return 0; };
  };
  
  int dir_mag(double dir, double mag)
  {
      cout &lt;&lt; "Direction: " &lt;&lt; dir &lt;&lt; '\n';
      cout &lt;&lt; "Magnitude: " &lt;&lt; mag &lt;&lt; '\n';
      return 0;
  }
  </code></pre>
  
  <p>Whenever I try to compile I get the error,</p>
  
  <pre><code>13:39: error: only constructors take member initializers
  </code></pre>
  
  <p>Any help please?</p>