title: Why Class C++ can be equal to a variable
body: <p>I have this code:</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  using namespace std;
  
  class complex
  {
      double re;
      double im;
  
  public:
      complex(): re(0), im(0) {}
      complex(double x) {re = x, im = x;}
      complex(double x, double y) {re=x, im =y;}
      void print() {cout &lt;&lt; re &lt;&lt; &quot; &quot; &lt;&lt; im;}
  };
  
  int main()
  {
      complex c1;
      double i=2;
      c1 = i;
      c1.print();
  
      return 0;
  }
  </code></pre>
  <p>My question is, why the code in this line compiles.</p>
  <pre><code>c1 = i;
  </code></pre>
  <p>The compiler gives no error(or warning), why?</p>