Inheritance vs Polymorphism (Easy Points)
Aspect Inheritance Polymorphism
Meaning One class gets properties of another One function works in different ways
Use To reuse code To change behavior
Type Base and derived class Function overloading or overriding
Example Dog inherits Animal Speak() works differently for Dog and Cat
Focus Class relationship Function behavior
Helps in Reducing code repetition Writing flexible code
Code class B : public A {} virtual void show()