Question: I was going through the difference between inheritance and composition. Everyone has praised composition over inheritance, so questions is how do we make choice ? Also if we didn't use inheritance at all then what are we going to miss as per OOP principal ?

Answer: 
This is a big complicated topic, perhaps too much to be described in a few SO posts.
Inheritance can be tricky, People have done Ph.D dissertations on this. Most of the time when I write new code I keep inheritance to a minimum.

When your Dog class inherits Mammal all the state/behavior of Mammal must still apply.
(the dog *is* a mammal). Is a platypus a mammal? Biology-yes, but it may not apply to your needs. Especially when you have mutable objects you run into 
messy situations such as <https://en.wikipedia.org/wiki/Circle%E2%80%93ellipse_problem#Description>

Also in real life there's often goofy couplings between parent and child classes.
You can google thousands articles about it. So if you want to understand more deeply, google and learn, we dont have to reinvent wheel here.

If you want short explanation what `composition over inheritance` means, it basically says - do not overengineer your solution with some super complex inheritance. If you develop something and you see some clear advantages of inheritance and you cant achieve the same with composition, you are free to use inheritance. If you dont see it or you can achieve the same with composition, use composition.