b***k 发帖数: 2673 | 1 ☆─────────────────────────────────────☆
ccca (cc) 于 (Wed Jul 2 16:25:35 2008) 提到:
发信人: ccca (cc), 信区: Programming
标 题: Re: C++: operator new 为啥要是 static的, 不是有啥影响?
发信站: BBS 未名空间站 (Wed Jul 2 16:25:26 2008), 转信
class A{
public:
void* operator new(size_t){A* p=this;};
}
编译器如是说,
d:\documents\visual studio 2005\projects\xx1\xxx1\xxx1.cpp(20
) : error C2671: 'A::operator new' : static member functions do not have
'this' pointers
☆─────────────────────────────────────☆
binrose (BigHead) 于 ( |
|