OOP allows you to avoid code like this:<p>function makesound() {
  if( thing is a Cat )
    return &quot;meow&quot;;
  else if (thing is a mouse)
    return &quot;eep&quot;:
  else if (thing is a sheep)
    return &quot;baa&quot;;
}<p>Code like this in an OOP language would be replaced by creating classes, such that the structure of the program implicitly executes the if else switch above, without you having to write it.<p>class Cat
{
  makesound() {
     return &quot;meow&quot;;
  }
}<p>class Mouse {
  makesound() {
    return :eep&quot;;
  }
}
.
.
.<p>Then if all those classes inherit from a common animal ancestor, the calling code would simply say: animal.makesound()<p>This becomes very convenient when the program behaviour relies on a combination of two or more types.<p>In that case the if else example would have to contain nested and possibly repeated ifs (or calls to functions) to handle the logic for all the variations.<p>Note that inheritance in this example isn&#x27;t to reuse code, just to establish the relationship between subtypes.<p>If you become tempted to use the type system as a clumsy code reuse mechanism, you will encounter alligators for sure.<p>Neither type of code is good or bad, just convenient for different purposes or not.<p>OOP is especially nice for writing simulations. See: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Simula" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Simula</a>