如果某个类型的默认成员被删除,那么该声明的可访问性是否有所不同?
class FooA {
public:
FooA() = delete;
FooA(FooA const&) = delete;
FooA& operator=(FooA const&) = delete;
}
class FooB {
private:
FooB() = delete;
FooB(FooB const&) = delete;
FooB& operator=(FooB const&) = delete;
}
class FooC {
protected:
FooC() = delete;
FooC(FooC const&) = delete;
FooC& operator=(FooC const&) = delete;
}
答案 0 :(得分:5)
虽然accessibility and deletedness are orthogonal,但很难看出你提议的案例会有什么实际差异。
答案 1 :(得分:2)
可能是人为的,但确实有所不同
class FooA {
private:
FooA& operator=(FooA const&) = delete;
};
class FooB : FooA {
// ill-formed because FooB has no access
using FooA::operator=;
};
是否是实用的差异......我真的不知道。如果FooA
是模板参数,并且您说using T::BazBang
,则可能会在实践中发生。