我有一个名为 LibItem 的抽象类,以及一个派生自该类的 DVD 类。
这是我的代码:
DVD.h:
//---------------------------------------------------------------------------
#ifndef DVDH
#define DVDH
class DVD : public LibItem
{
public:
DVD(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, int, const std::string&, const std::string&, const std::string&);
void setRunningTime(int RunningTimeDetails);
int getRunningTime();
void setDirector(const std::string&);
std::string getDirector();
void setStudio(const std::string&);
std::string getStudio();
void setProducer(const std::string&);
std::string getProducer();
void PrintDetails();
private:
DVD();
int RunningTime;
std::string Director;
std::string Studio;
std::string Producer;
};
//---------------------------------------------------------------------------
#endif
DVD.cpp:
//---------------------------------------------------------------------------
#pragma hdrstop
#include "DVD.h"
DVD::DVD(const std::string& setItemTitle, const std::string& setItemAuthor, const std::string& setItemReleaseDate, const std::string& setItemCopyright, const std::string& setItemGenre, const std::string& setItemStatus, int setItemRunningTime, const std::string& setItemDirector, const std::string& setItemStudio, const std::string& setItemProducer)
{
setDetails(setItemTitle, setItemAuthor, setItemReleaseDate, setItemCopyright, setItemGenre, setItemStatus);
setRunningTime(setItemRunningTime);
setDirector(setItemDirector);
setStudio(setItemStudio);
setProducer(setItemProducer);
}
void DVD::setRunningTime(int RunningTimeDetails)
{
RunningTime = RunningTimeDetails;
}
int DVD::getRunningTime()
{
return RunningTime;
}
void DVD::setDirector(const std::string& DirectorDetails)
{
Director = DirectorDetails;
}
std::string DVD::getDirector()
{
return Director;
}
void DVD::setStudio(const std::string& StudioDetails)
{
Studio = StudioDetails;
}
std::string DVD::getStudio()
{
return Studio;
}
void DVD::setProducer(const std::string& ProducerDetails)
{
Producer = ProducerDetails;
}
std::string DVD::getProducer()
{
return Producer;
}
void DVD::PrintDetails()
{
cout << "Title: " << getTitle() << endl;
cout << "Author: " << getAuthor() << endl;
cout << "Release Date: " << getReleaseDate() << endl;
cout << "Copyrite: " << getCopyright() << endl;
cout << "Genre: " << getGenre() << endl;
cout << "Status: " << getStatus() << endl;
cout << "Running Time: " << getRunningTime() << endl;
cout << "Director: " << getDirector() << endl;
cout << "Studio: " << getStudio() << endl;
cout << "Producer: " << getProducer() << endl;
}
//---------------------------------------------------------------------------
#pragma package(smart_init)
我收到此错误:
[ILINK32 错误] 错误:未解析的外部 'DVD::DVD(std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, int, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&, std::basic_string, std::allocator >&)' 引用自 H:\2012\TRIMESTER 2\IT6253 - C++ PROGRAMMING\ASSESMENT\QUESTION 5\WIN32\DEBUG\QUESTION 5.OBJ
我可以帮忙解决这个错误吗?