64,649
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <iostream>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <vector>
using namespace std;
class base
{
public:
base(int = 0);
void fo(int a)
{
*this = a;
}
operator int () const
{
return m_s;
}
private:
int m_s;
};
base::base(int s)
{
m_s = s;
}
int _tmain(int argc, _TCHAR* argv[])
{
base l;
l.fo(5);
int a = l + 5;
cout << a << endl;
system("pause");
return 0;
}
class base
{
public:
base(int = 0);
void fo(int a)
{
*this = a;
}
operator int () const
{
return m_s;
}
private:
float m_f; //增加一个成员,那么你fo必须做调整
int m_s;
private:
int m_ss; //标准不对两个段的内存规定数据内存的顺序进行规定
};