title: C++ error -- expression must have integral or enum type -- getting this from a string with concatenation?
body: <p>C++ error <strong>expression must have integral or enum type</strong> getting this from a string with concatenation?</p>
  
  <p>So in the <code>toString()</code> of a class in C++ I have the code:</p>
  
  <pre><code>string bags = "Check in " + getBags() + " bags";
  </code></pre>
  
  <p>I thought I could declare a string like this? (I'm coming from a Java background and trying to learn C++). The <code>bags</code> is underlined in Visual Studio though and the problem is:</p>
  
  <blockquote>
    <p>expression must have integral or enum type.</p>
  </blockquote>
  
  <p><code>getBags()</code> just returns an <code>int</code>. </p>
  
  <p>Another example where this happens is with:</p>
  
  <pre><code>string totalPrice = "Grand Total: " + getTotalPrice();
  </code></pre>
  
  <p><code>getTotalPrice()</code> returns a <code>float</code> and is what is underlined with the error. </p>
  
  <p>But then if I put in a line like:</p>
  
  <pre><code>string blah = getBags() + "blah";
  </code></pre>
  
  <p>No errors.</p>
  
  <p>What am I not understanding here?</p>