How to use pure virtual functions and abstract classes in C++
What this article shares with you is about how to use the pure virtual functions and abstract classes in C++. The editor thinks it is very practical, so I hope you can learn something after reading this article. Let's take a look at it with the editor.
/ * Pure virtual functions and abstract classes-Why not 2014/01/05*/#include#includeusing namespace std;const double pi=3.14159;class Shape {public: virtual void show (void) = 0; virtual double area (void) = 0; class triangle:public Shape {public: triangle (double=0,double=0,double=0); void show (void); double area (void); private: double a dagger bjort c;}; class rectangle: public Shape {public: rectangle (double=0,double=0) Void show (void); double area (void); private: double width,length;}; class circle: public Shape {public: circle (double = 0); void show (void); double area (void); private: double r;}; triangle::triangle