title: My member function designed to change a particular member data in a class doesn't actually change it
body: <p>I have started to write a program that makes a drink and calculates the price of it based on the different variables (toppings, size). However, when trying to write a function called setSize, designed to change the size of a particular drink, the bool value which keeps track of the size of the drink stays the same.</p>
  <p>Here is my class:</p>
  <pre><code>class Boba {
      const double basePrice = 3.5;
      const double largeDrinkPrice = 1.;
      const double toppingPrice = 0.3;
  private:
      string flavor;
      int toppings;
      bool isLarge;
      double price;
      void updatePrice();
  public:
      Boba(string flavor1, int toppings1, bool isLarge1) {
          flavor = flavor1;
          toppings = toppings1;
          isLarge = isLarge1;
      }
      void setFlavor(string flavor);
      void setSize(bool isLarge);
      bool setToppings(int toppings);
      double getPrice();
      void printDrink();
  };
  </code></pre>
  <p>I call this in my main function:</p>
  <pre><code>int main(int argc, const char* argv[])
  {
  
      std::cout &lt;&lt; std::fixed &lt;&lt; showpoint;
      std::cout &lt;&lt; std::setprecision(2);
  
      Boba myDrink1(&quot;almond milk tea&quot;, 2, false);
  
      myDrink1.printDrink();
  
      cout &lt;&lt; &quot;Changing myDrink1 to a large size.&quot; &lt;&lt; endl;
      myDrink1.setSize(true);
      myDrink1.printDrink();
      cout &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  <p>My print drink function in case something goes wrong inside here:</p>
  <pre><code>void Boba::printDrink()
  {
      cout &lt;&lt; &quot;Boba with flavor &quot; &lt;&lt; flavor &lt;&lt; &quot;, &quot; &lt;&lt; toppings &lt;&lt; &quot; toppings&quot;;
      if (isLarge)
          cout &lt;&lt; &quot;, size large&quot;;
      cout &lt;&lt; &quot;. $&quot; &lt;&lt; getPrice() &lt;&lt; endl;
  }
  
  double Boba::getPrice()
  {
      updatePrice();
      return price;
  }
  </code></pre>
  <p>And this is where I am having problems, inside my setSize function and updatePrice function:</p>
  <pre><code>void Boba::updatePrice()
  {
      if (isLarge) {
          price = largeDrinkPrice + (toppings * toppingPrice) + basePrice;
      }
      else {
          price = (toppings * toppingPrice) + basePrice;
      }
  }
  
  void Boba::setSize(bool isLarge)
  {
      isLarge = true;
      updatePrice();
  }
  </code></pre>
  <p>Edit: It seems that when it goes back to the update price function it turns false for isLarge.</p>