#ifndef _INT_H_
#define _INT_H_
class Int{
private:
int value;
public:
Int();//这是默认构造函数
Int(Int const&);//这是copy构造函数
Int(int);//赋值构造函数
int getValue()const;
};
int Int::getValue()const{
return value;
};//给取值函数加定义注意在开头加上函数类型
Int::Int(Int const&light){
this->value= light.value;
};//函数的构造不用声明函数类型
Int::Int(int v){
value=v;
};不用定义其值
Int::Int(){value=0;};要给初始值
#endif
#define _INT_H_
class Int{
private:
int value;
public:
Int();//这是默认构造函数
Int(Int const&);//这是copy构造函数
Int(int);//赋值构造函数
int getValue()const;
};
int Int::getValue()const{
return value;
};//给取值函数加定义注意在开头加上函数类型
Int::Int(Int const&light){
this->value= light.value;
};//函数的构造不用声明函数类型
Int::Int(int v){
value=v;
};不用定义其值
Int::Int(){value=0;};要给初始值
#endif