面试题48 不能被继承的类
1 class A 2 { 3 public: 4 static A* getInstance() 5 { 6 return new A(); 7 } 8 9 static void DeleteInstance(A *a) 10 { 11 delete a; 12 } 13 private: 14 A(){} 15 ~A(){} 16 };
1 template<class T> class B 2 { 3 friend T; 4 private: 5 B(){} 6 ~B(){} 7 }; 8 9 class C:virtual public B<C> 10 { 11 public: 12 C(){} 13 ~C(){} 14 };