C++ Generic Linked List

前端 未结 4 1286
旧巷少年郎
旧巷少年郎 2021-01-29 00:38

For the code below:

#include 
#include 

using namespace std;

class Foo2;
class Foo3;

template 
class Foo1 {
  pub         


        
4条回答
  •  再見小時候
    2021-01-29 01:00

    Combining the bits, it seems like this should work:

    int main() {
      std::list > list;
      list.push_back(Foo2());
      list.push_back(Foo3());
      printAll(list); // You'd still need to write this obviously.
      return 0;
    }
    

提交回复
热议问题