title: C++ Overload Typecast to Double
body: <p>I'm working on an another assignment and I can't figure out how to overload a typecast to double. I need to provide the implementation. Would appreciate some help. Thanks!</p>
  
  <p>Here's the function prototype/declaration in my HugeInteger.h file. </p>
  
  <pre><code>operator double(void)const;
  </code></pre>
  
  <p>Here's a sample of code to test the overloaded type cast to double operator. </p>
  
  <pre><code>cout &lt;&lt; "\n****** Test overloaded type cast to double operator ******\n";
      cout &lt;&lt; "\nA = " &lt;&lt; A &lt;&lt; "\nB = " &lt;&lt; B &lt;&lt; "\n";
      double dA = (double)A;             // one way to invoke cast operator
      double dB = static_cast&lt;double&gt;(B); // another way to invoke cast operator
      cout &lt;&lt; "\nA cast to a double is: " &lt;&lt; dA;
      cout &lt;&lt; "\nB cast to a double is: " &lt;&lt; dB &lt;&lt; '\n' &lt;&lt; endl;
  </code></pre>