|
在一个动态连接库的.h文件里,有个结构体
#if defined DLL_EXPORT
#define FVFIXED_API __declspec(dllexport)
#else
#define FVFIXED_API __declspec(dllimport)
#endif
struct FVFIXED_API CFvFixed {
public:
CString m_str;
public:
friend const CFvFixed operator+(const CFvFixed x, const CFvFixed y);
friend const CFvFixed operator-(const CFvFixed x, const CFvFixed y);
friend const CFvFixed operator*(const CFvFixed x, long y);
friend const CFvFixed operator*(long x, const CFvFixed y);
friend const CFvFixed operator*(const CFvFixed x, const CFvFixed y);
};
FVFIXED_API BOOL FvFixedToDouble(CFvFixed &x, double* result);
在一个动态连接库的.cpp文件里
FVFIXED_API CFvFixed const operator+(const CFvFixed x, const CFvFixed y)
{
CFvFixed newFv;
TCHAR* stopstring;
double i, k;
i = wcstod(x.m_str, &stopstring);
k = wcstod(y.m_str, &stopstring);
//newFv.m_str.Format(L"%f", i+k);
return newFv;
}
FVFIXED_API BOOL FvFixedToDouble( CFvFixed &MyTest, double* result)
{
MyTest.m_str = "hello999";
return true;
}
请问1:operator+ 是重载加号还就是个函数名字?
2:红色的FVFIXED_API 这个用不用加? 我试过加了就编译错了,为什么不加,下边那个函数怎么就加了,有什么区别??
|
|