title: How can I improve my UML modellisation of the following code in C++?
body: <p>I am modelling a basic code in c++ using UML.
  I have a first draft.
  I would like to have a feedback about how I could improve it or if I missed something or if there is something wrong with the graph.</p>
  
  <p>The UML diagram:
  <a href="https://i.stack.imgur.com/qBwsT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qBwsT.png" alt="structural diagram"></a></p>
  
  <p>And the code:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;ctime&gt;
  #include &lt;functional&gt;
  #include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;numeric&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  
  // CLASS: declaration -------------------------------------
  // # Animal ...............................................
  class Animal{
      private:
          std::string name;
          double height;
          double weight;
  
          // member of a class as static { bit.ly/2EXnDTW }
          static int numOfAnimals;
      public:
          static int GetNumOfAnimals(){return numOfAnimals;}
  
          void SetName(std::string name){this-&gt;name = name;} //&lt;mutator/SETTER
          std::string GetName(){return name;} //&lt;accessor/GETTER
  
          void SetHeight(double height){this-&gt;height = height;}
          double GetHeight(){return height;}
  
          void SetWeight(double weight){this-&gt;weight = weight;}
          double GetWeight(){return weight;}
  
          //note: possible not to provide a name here with your prototypes
          //ex: void SetAll(std::string, double, double);
          void SetAll(std::string name, double height, double weight);
  
          Animal(std::string name, double height, double weight); //&lt;constructor
          Animal(); //&lt;overload constructor when no attributes are passed
          ~Animal(); //&lt;deconstructor
  
          void ToString();
  };
  
  int Animal::numOfAnimals = 0;
  
  void Animal::SetAll(std::string name, double height, double weight){
      this-&gt;name = name;
      this-&gt;height = height;
      this-&gt;weight = weight;
  }
  //constructor
  Animal::Animal(std::string name, double height, double weight){
      this-&gt;name = name;
      this-&gt;height = height;
      this-&gt;weight = weight;
      Animal::numOfAnimals++;
  }
  //overload constructor when no attributes are passed
  Animal::Animal(){
      this-&gt;name = "";
      this-&gt;height = 0;
      this-&gt;weight = 0;
      Animal::numOfAnimals++;
  }
  //destructor
  Animal::~Animal(){ std::cout &lt;&lt; "Animal " &lt;&lt; this -&gt; name &lt;&lt; " destroyed\n";}
  
  void Animal::ToString(){
      std::cout &lt;&lt; this -&gt; name &lt;&lt; " is "
                &lt;&lt; this -&gt; height &lt;&lt; " cms tall and "
                &lt;&lt; this -&gt; weight &lt;&lt; " kgs in weight\n";
  }
  
  // # Dog ..................................................
  class Dog: public Animal{
      private:
          std::string sound = "woof";
      public:
          void MakeSound(){ printf("The dog %s says %s\n", this-&gt;GetName().c_str(), this-&gt;sound.c_str());}
          Dog(std::string name, double height, double weight, std::string sound);
          Dog(): Animal(){};
          void ToString();
  };
  
  Dog::Dog(std::string name, double height, double weight, std::string sound) :
  Animal(name, height, weight){
      this-&gt;sound = sound;
  }
  
  void Dog::ToString(){
      //printf("%s is %d cms tall and %d kgs in weight and says %s\n",
      //        this-&gt;GetName().c_str(), this-&gt;GetHeight(), this-&gt;GetWeight(), this-&gt;sound.c_str());
      // note: do not work well with this-&gt;GetHeight() and this-&gt;GetWeight()
      std::cout &lt;&lt; this -&gt; GetName()   &lt;&lt; " is "
                &lt;&lt; this -&gt; GetHeight() &lt;&lt; " cms tall and "
                &lt;&lt; this -&gt; GetWeight() &lt;&lt; " kgs in weight and says "
                &lt;&lt; this -&gt; sound       &lt;&lt; "\n";
  }
  
  // END CLASS ----------------------------------------------
  
  int main (int argc, char** argv) {
      //create 1st animal - fred
      Animal fred;
      //test overloaded constructor
      fred.ToString();
      //add attributes value of 1st animal - Fred
      fred.SetHeight(33);
      fred.SetWeight(10);
      fred.SetName("Fred");
      fred.ToString();
      //create 2nd animal using constructor - tom
      Animal tom("Tom", 36, 15);
      tom.ToString();
      //create 1st dog - spot
      Dog spot("Spot", 38, 16, "woofWoof");
      //print 2nd dog info
      spot.ToString();
      spot.MakeSound();
      //print number of animal
      std::cout &lt;&lt; "Number of Animals : " &lt;&lt; Animal::GetNumOfAnimals() &lt;&lt; "\n";
      return 0;
  }
  </code></pre>
  
  <p>The expected and current output of the code:</p>
  
  <ul>
  <li>is 0 cms tall and 0 kgs in weight</li>
  <li>Fred is 33 cms tall and 10 kgs in weight</li>
  <li>Tom is 36 cms tall and 15 kgs in weight</li>
  <li>Spot is 38 cms tall and 16 kgs in weight and says woofWoof</li>
  <li>The dog Spot says woofWoof</li>
  <li>Number of Animals : 3</li>
  <li>Animal Spot destroyed</li>
  <li>Animal Tom destroyed</li>
  <li>Animal Fred destroyed</li>
  </ul>