b***k 发帖数: 2673 | 1 ☆─────────────────────────────────────☆
ccca (cc) 于 (Wed Jul 2 16:47:44 2008) 提到:
发信人: ccca (cc), 信区: Programming
标 题: C++: protect dtor
发信站: BBS 未名空间站 (Wed Jul 2 16:46:22 2008), 转信
C++ coding standards 101:
50:
Make base class destructors public and virtual, or protected and nonvirtual
但是如果 dtor is protected, Base class can't be instantiated...
So dtor must be public and virtual..
所以我想作者是不是搞错了。。。
class A
{
protected:
~A();
}
int main()
{
A a;
A* p=new A() |
|