64,281
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <sstream>
using namespace std;
typedef struct Int32
{
int m_value;//这个值如何变成此结构!或者说m_value就是this
static const int MaxValue = 2147483647;
static const int MinValue = 2147483648;
public:
int CompareTo(int value)
{
if (m_value < value) return -1;
if (m_value > value) return 1;
return 0;
}
static int Parse(char* s)
{
int n;
istringstream iss;
iss.clear();
iss.str(s);
iss >> n;
return n;
}
string ToString()
{
ostringstream oss;
oss << m_value;
return oss.str();
}
private:
}Integer;
int main()
{
Integer num;
num.m_value = 111;//什么实现正常的 赋值 num = 111;
string str; // 读值 int numB = num;
str = num.ToString();
return 0;
}
Int32& operator=(int num)
{
......
m_value = num;
return *this;
}
num=111;
会报错啊,VS2015