請看看下面的代碼模板鏈接列表:任何成員提供錯誤
LinkedList.h
template <typename T>
class LinkedList
{
public:
T *first;
LinkedList()
{
first = 0;
}
~LinkedList(){}
T *Delete()
{
}
T *Delete(const int key)
{
}
void Display()
{
}
T *Find(const int key)
{
}
void Insert(T* newLink)
{
//newLink->next = first;
//first = newLink;
}
bool IsEmpty()
{
return (first==0);
}
};
Weapon.h
#pragma once
#include "GameObject.h"
#include "Stack.h"
#include "Round.h"
class Weapon :
public GameObject
{
public:
Weapon(int);
~Weapon(void);
Stack <Round> stack1;
Weapon *next;
void Display();
};
武器。 cpp
#include "Weapon.h"
#include <iostream>
using namespace std;
Weapon::Weapon(int size) : stack1(size)
{
}
Weapon::~Weapon(void)
{
}
在這裏,武器代表鏈接列表中的鏈接。 Next
是指向列表中下一個武器的指針。但是我怎樣才能訪問它?我嘗試在鏈接列表的Insert()
方法不起作用。我評論過他們。請幫忙!
你是什麼意思的「沒有工作」? – us2012 2013-02-26 22:35:01
@ us2012:我不能指向'下一個'。 intellisense說沒有會員可用。 – 2013-02-26 22:47:47