compile通过,但excute是出现错误,这两个之间有什么区别?
出现错误提示是什么愿因?
f:\sourcecode\c++\datastructure\chapter3\linklist.cpp(63) : error C2440: '=' : cannot convert from 'class LinkNode<int> *(__thiscall LinkNode<int>::*)(void)' to 'class LinkNode<int> *'
There is no context in which this conversion is possible
d:\program files\microsoft visual studio\vc98\include\xmemory(59) : while compiling class-template member function 'void __thiscall
有没有vc6.0针对编译的入门书籍?
vc6的补丁在哪儿可下载?
出现错误提示是什么愿因?
f:\sourcecode\c++\datastructure\chapter3\linklist.cpp(63) : error C2440: '=' : cannot convert from 'class LinkNode<int> *(__thiscall LinkNode<int>::*)(void)' to 'class LinkNode<int> *'
There is no context in which this conversion is possible
d:\program files\microsoft visual studio\vc98\include\xmemory(59) : while compiling class-template member function 'void __thiscall
有没有vc6.0针对编译的入门书籍?
vc6的补丁在哪儿可下载?
你提的问题好大!!!
《C++程序调试》一书应该可以让你入门,里面用的是Visual C++ 6.0
楼上四座山峰的老大,能不能帮个忙,解释一下原因?给个链接也可。
class LinkNode<int> *(__thiscall LinkNode<int>::*)(void)
是一个函数指针
class LinkNode<int> *显然不是,两者不能转换。
再仔细查查代码吧。
// LinkList.h: interface for the LinkList class.
//
//////////////////////////////////////////////////////////////////////#if !defined(AFX_LINKLIST_H__A9A55711_40F0_47B0_9B15_EACDB6F9AC7A__INCLUDED_)
#define AFX_LINKLIST_H__A9A55711_40F0_47B0_9B15_EACDB6F9AC7A__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "..\stdafx.h"template <typename elemType> class LinkList;template <typename elemType> class LinkNode
{
friend class LinkList<elemType>;
public:
LinkNode(const elemType elem):data(elem),nextNode(0) {};
LinkNode(const LinkNode *n):data(n->data),nextNode(0){};
virtual ~LinkNode();
inline LinkNode<elemType> *NextNode() {return nextNode;}
inline elemType &GetData() {return data;}
private:
elemType data;
LinkNode<elemType> *nextNode;
};template <typename elemType> class LinkList
{
public:
LinkList();
virtual ~LinkList(); void Insert(const elemType &,const int &);
LinkNode<elemType> *GetFirst() {return first;}
LinkNode<elemType> *Find(elemType &);
void Delete(const int &i);
int Length() {return length;}
private:
int length;
LinkNode<elemType> *first;
};#endif // !defined(AFX_LINKLIST_H__A9A55711_40F0_47B0_9B15_EACDB6F9AC7A__INCLUDED_)
//
//////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
using namespace std;
#include "..\stdafx.h"
#include "LinkList.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
template <typename elemType>
LinkList<elemType>::LinkList():first(0)
{
}
template <typename elemType>
LinkList<elemType>::~LinkList()
{
}template <typename elemType>
void LinkList<elemType>::Insert(const elemType &elem,const int &index)
{
LinkNode<elemType> *p = first; int k = 0;
while ((p != 0) && (k < index -1))
{
p = p->NextNode;
k ++;
} if ((p == 0) && (first != 0))
{
cout << ("out range of array") << endl;
//return 0;
}
/*
LinkNode<elemType> *newNode = new LinkNode<elemType>(elem);
if ((first == 0) || (index == 0))
{
newNode->NextNode = first;
first = newNode
}
else
{
newNode->NextNode = p->NextNode;
p->NextNode = newNode;
}
*/
}template <typename elemType>
LinkNode<elemType> *LinkList<elemType>::Find(elemType &elem)
{
LinkNode *temp = first->NextNode;
while (temp != 0)
{
if (elemType == temp.data)
{
break;
}
temp = temp->NextNode;
}
return temp;}template <typename elemType>
void LinkList<elemType>::Delete(const int &index)
{
return;
}
while ((p != 0) && (k < index -1))
{
p = p->NextNode; --这一句提示错误的,但编译通过
k ++;
}