这两个头文件是:
#ifndef VIDEO_H
#define VIDEO_H
#include <string>
#include <iostream>
using namespace std;
class Video
{
public:
Video(string title, string URL, string comment, float length, int rating);
~Video();
void print();
bool longer(Video *Other);
bool higher(Video *Other);
bool alphabet(Video *Other);
private:
string m_title;
string m_url;
string m_comment;
float m_length;
int m_rating;
};
#endif
而第二个......
#ifndef VLIST_H
#define VLIST_H
#include <string>
#include <iostream>
using namespace std;
class Vlist
{
public:
Vlist();
~Vlist();
void insert(string title, string URL, string comment, float length, int rating);
bool remove();
private:
class Node
{
public:
Node(class Video *Video, Node *next)
{m_video = Video; m_next = next;}
Video *m_video;
Node *m_next;
};
Node* m_head;
};
#endif
我正在尝试访问一个名为 insert 的成员函数,但我不太确定如何执行此操作....这是我迄今为止想出的。
Array[i] = new Video(title, URL, comment, length, rating);
Vlist *list = new Vlist;
list->insert(title, URL, comment, length, rating);
上面和下面还有更多代码,但这是我遇到问题的区域。它会在行上读取 (Vlist *list = new Vlist;) : undefined reference to 'Vlist::Vlist()'