title: left of '.expression' must have class/struct/union
body: <p>In this code I have an object that contains two variables hours and minutes. Im trying to consecutively add a value of 15 minutes and a value of 20 minutes to an object called t1. But I get the error : left of '.plus' must have class/struct/union.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>#include &lt;iostream&gt;        
  #include &lt;iomanip&gt; 
  using namespace std;
  
  class Time {
  public:
  Time(int u, int m);
  Time(int g);
  void plus(Time t);
  void plus(int x);
  void print();
  
  private:
  int min;
  int hour;
  };
  
  void Time::plus(Time t) {
  min += t.min;
   if (min &gt; 59) {
      hour++;
      min = min - 60;
   }
  }
  
  void Time::plus(int x) {
  min += x;
   if (min &gt; 59) {
      hour++;
      min = min - 60;
   }
  }
  
  void Time::print() {
  
  cout &lt;&lt; setw(2) &lt;&lt; hour &lt;&lt; " hour and " &lt;&lt; min &lt;&lt; " minutes";
  }
  
  Time::Time(int u, int m) : hour(u), min(m) {
  
  }
  
  Time::Time(int m) : hour(0), min(m) {
  }
  
  
  int main() {
  Time t1(1, 10);        
  const Time kw(15);     
  t1.plus(kw).plus(20);     
  cout &lt;&lt; "t1 = "; t1.print(); cout &lt;&lt; endl;
  cin.get();
  return 0;
  }
  </code></pre>