1 #include <iostream>
 2 #include<string>
 3 #include<map>
 4 #include<vector>
 5 #include"thread_pool.h"
 6 
 7 
 8 using namespace std;
 9 template<class T>
10 class base{
11     friend T;/// friend class
12 private:
13     base(){}
14     ~base(){}
15 };
16 
17 class derived : public virtual base<derived>
18 {
19 public:
20     derived(){}
21     void show(){
22         cout<<"can be instanced,but can not be inherited"<<endl;
23     }
24     ~derived(){}
25 };
26 
27 class dderived : public derived{
28 public:
29     dderived(){}
30     ~dderived(){}
31 };
32 
33 
34 
35 int main()
36 {
37     cout << "Hello world!" << endl;
38     derived d;
39     d.show();
40     return 0;
41 }
View Code

相关文章:

  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2021-08-06
猜你喜欢
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-11-16
相关资源
相似解决方案