33问答网
所有问题
float getHeight() const; float area() const; float volume() const; const是啥意思
如题所述
举报该问题
其他回答
第1个回答 2012-04-28
你这些函数是类的成员函数吧,在函数后面加上const是限制这些函数不能修改类成员变量。
const是用来修饰和定义常量的,有点带有不可变的意思
相似回答
c++编程题
答:
float
h); float
GetVolume()
const;
}; Box::Box() : width(1),
height(
1) {} Box::Box(float w, float h): width(w), height(h) {} float Box::GetVolume() const { return height * width * width;} int
...在该类定义中包括数据成员:length(长)、width(宽) 和
height(
高...
答:
float
length, width, height;public:Box
();
Box(float l, float w, float h);float
GetVolume()
const;
};Box::Box() : length(1), width(1),
height(
1) {} Box::Box(float l, float w, float h): length(l), width(w), height(h) {} float Box::GetVolume() const { retur...
...类定义中包括数据成员: length(长),width(宽)和
height(
答:
float
w, float h);float
GetVolume()
const;
};Box::Box(float l = 1, float w = 1, float h = 1) : length(l), width(w),
height(
h) {}float Box::GetVolume() const {return height * width * length;}
大家正在搜
static const
const char
const int *p
c语言const int
float和double
从double到float截断
float和double大小
constint
const和let
相关问题
C++连接时出现问题,在线等.
求大神对 const float *const * 修饰的详...
C++语言里 float const 这组合是什么意思?
c语言 数据类型const float必须大写?
一个C++问题 急求
C++, float getX( )const {retur...
书上的C++程序运行有问题 求大神帮忙我用的VC6.0 源程...
为什么我的程序出现这样的错误?下面是程序代码,错误信息在最底...