回复 10楼 rjsp
对,这就是我想问的,请问输出的为什么是2.07357e-317
另外问一下,
#include <iostream>
using namespace std;
class Line
{
public:
void setLength( double len );
double getLength( void );
Line(double len);
private:
double length;
double width;
};
Line::Line( double len)
{
cout << "Object is being created, length = " << len << endl;
width = len;
}
void Line::setLength( double len )
{
length = len;
}
double Line::getLength( void )
{
return length;
}
int main( )
{
Line line(10.0);
cout << "Length of line : " << line.getLength() <<endl;
line.setLength(6.0);
cout << "Length of line : " << line.getLength() <<endl;
return 0;
}
Line line(10.0);是LINE构造函数的实参,也是setLength()的实参吗? 这个是怎么判断的