首页 > 解决方案 > C++ 需要一个类型说明符

问题描述

我尝试使用构造函数将类对象创建到另一个类中,但出现“需要类型说明符”的错误。我研究了示例代码,但在我的代码中找不到任何错误。错误在Cotp_connection.h文件中LinkedList<uint8_t> list(0,NULL);

链表.h

#include <cstdint>
#include <vector>
using namespace std;


template  <class T> class LinkedList
{
public:
    LinkedList() {};
    LinkedList(int size, LinkedList* next) :size(size), next(next) {};
    vector <T> data;
    int size;
    LinkedList* next;


};

Cotp_connection.h

#include "connect_tcp.h"
#include "LinkedList.h"


class Cotp_connection {
public:
    LinkedList <uint8_t> list(0,NULL); // Error is here


};

标签: c++constructor

解决方案


推荐阅读