I am trying to learn about main pillars of OOP.
When I was reading Inheritance definition in Microsoft docs. there were this part:
Inheritance enables you to create new classes that reuse, extend, and modify the behavior that is defined in other classes.
You thinking is correct. Inheritance and Polymorphism go hand in hand but they are not the same thing. Polymorphism can be a result of inheritance but not always, one can exist without the other.
In the definition, the "...modify the behavior that is defined in other classes." in my view refers to polymorphism which can be static (overloading) or dynamic (overriding). The example you gave about the Speak() method is dynamic polymorphism. You can declare the Speak() method as virtual or abstract (which will make the whole class abstract) in the Animal class and override it in the Cat and Dog sub-classes using the "override" keyword thereby changing the Speak() behavior that is defined in Animal, which is what the definition says. Check this link: https://www.tutorialspoint.com/csharp/csharp_polymorphism.htm