Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use pure virtual functions and abstract classes in C++

Shulou Source: shulou.com Published: 2022-06-03 05:57:22 11月17日 Update

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

Tags: Function censor more knowledge article practical that is work meeting article look knowledge point industry details information information channel follow part channel study work Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Technology vpn Docker Microsoft