c++ 6.14
来源:互联网 发布:知父莫若子全文百度云 编辑:程序博客网 时间:2024/06/08 17:04
#include<iostream>using namespace std;const double b=3.14;class base{public:base(double h1){ h=h1;}virtual void disp()=0;protected:double h;};class cuboid:public base{public:cuboid(double h1,double w1,double k1):base(h1){w=w1; k=k1;}void disp(){cout<<"长方体的体积:"<<h*w*k<<endl;}protected:double w;double k;};class cylinder:public base{public:cylinder(double r1,double h1):base(h1){r=r1;}void disp(){cout<<"圆柱体的体积:"<<r*r*h*b<<endl;}protected: double r;};int main (){base *ptr;cuboid c1(2.1,3.1,4.0);cylinder l1(3.3,4.2);ptr=&c1;ptr->disp();cout<<"*************************"<<endl;ptr=&l1;ptr->disp();return 0;}
0 0
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- C
- c
- C
- 错误:_cspr_lp64_iface.c:(.text+0x28): undefined reference to `mkl_blas_cspr'类似未定义引用 *转载
- shell排序
- [LeetCode] Maximum Depth of Binary Tree
- block基础和retain cycle(循环引用)
- 【JAVA】集合类、泛型和反射
- c++ 6.14
- Aerospike C客户端手册———事务级一致性保证
- 中国软件工程师分类
- Resin Web服务器文件解析漏洞
- FPGA图像开发重要网址
- shift+F10无法进入cmd
- 包含min函数的栈
- Activity刷新
- Aerospike C客户端手册———最佳实践—记录使用