构造函数
来源:互联网 发布:我的世界mac版在哪买 编辑:程序博客网 时间:2024/05/21 11:21
#include<iostream>
using namespace std;
class Box
{
public:
Box();
Box(int l,int w,int h):length(h),width(w),height(h){};
int volume();
private:
int length;
int width;
int height;
};
Box::Box()
{
length=10;
width=10;
height=10;
}
int Box::volume()
{return(length * width * height);}
int main()
{
Box box1;
cout<<box1.volume()<<endl;
Box box2(15,30,25);
cout<<box2.volume()<<endl;
return 0;
}
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- 构造函数
- android Timer & TimerTask
- java基础知识记录--linux部分(摘自张孝祥整理java面试题)
- CCombBox精确匹配查找
- 第一阶段上
- ubuntu 正确输入 用户名和密码 后 重复登录界面
- 构造函数
- C#的DataGridView竖排显示的问题
- 一、第一个Struts2例子(Helloword)
- 第一阶段下
- web交互设计模型
- 笑话
- dll加载问题的解决方法
- 第二阶段
- C#中使用反射动态加载和卸载DLL