[Solved] Polymorphism vs Inheritance. Diffrence?
Here’s a version of your first example, that actually uses polymorphism: #include <iostream> #include <string> class shape { public: void setValues(int height_, int width_) { height = height_; width = width_; } virtual int area() = 0; // This is needed for polymorphism to work virtual std::string name() = 0; protected: int height; int width; … Read more