厨房为什么要两个oven?# Living
d*r
1 楼
下面这个code有错,因为m_value是const,不能赋值。能不能保留m_value的const属性
作其他改动使得code能够work呢?
class cTest
{
public:
cTest():{};
~cTest(){};
void SetValue( const double val ) const
{
m_value = val;
}
private:
double m_value;
};
int main( void )
{
cTest *t = new cTest();
t->SetValue(100);
delete t;
}
作其他改动使得code能够work呢?
class cTest
{
public:
cTest():{};
~cTest(){};
void SetValue( const double val ) const
{
m_value = val;
}
private:
double m_value;
};
int main( void )
{
cTest *t = new cTest();
t->SetValue(100);
delete t;
}