私はそのようなクラスを持っています:
class Product
{
public :
virtual double getPrice();
virtual void setPrice(double price);
};
class MusicProduct
{
protected:
string author;
double price;
public :
virtual string getAuthor();
virtual void setAuthor(string author);
~MusicProduct();
};
class CD : public MusicProduct, public Product
{
public :
string getAuthor();
void setAuthor(string author);
double getPrice();
void setPrice(double price);
};
string CD::getAuthor()
{
return MusicProduct::author;
}
void CD::setAuthor(string author)
{
MusicProduct:author = author;
}
void setPrice(double price)
{
MusicProduct::price = price;
}
double getPrice()
{
return MusicProduct::price;
}
そして、私はそれらのエラーを持っています:
/home/katie/Desktop/Temp/MusicStore.cpp||In member function ‘virtual bool MusicStore::hasProduct( Product)’:|
/home/katie/Desktop/Temp/MusicStore.cpp|15|warning: no return statement in function returning non-void [-Wreturn-type]|
/home/katie/Desktop/Temp/MusicStore.cpp||In member function ‘virtual Product MusicStore::getProduct( Product)’:|
/home/katie/Desktop/Temp/MusicStore.cpp|20|warning: no return statement in function returning non-void [-Wreturn-type]|
/home/katie/Desktop/Temp/MusicStore.cpp||In member function ‘virtual bool MusicStore::buyProduct( Product)’:|
/home/katie/Desktop/Temp/MusicStore.cpp|25|warning: no return statement in function returning non-void [-Wreturn-type]|
/home/katie/Desktop/Temp/MusicStore.cpp||In member function ‘virtual bool MusicStore::returnProduct( Product)’:|
/home/katie/Desktop/Temp/MusicStore.cpp|30|warning: no return statement in function returning non-void [-Wreturn-type]|
/home/katie/Desktop/Temp/Store/CD.cpp||In member function ‘virtual void CD::setAuthor(std::string)’:|
/home/katie/Desktop/Temp/Store/CD.cpp|12|warning: label ‘MusicProduct’ defined but not used [-Wunused-label]|
obj/Debug/Store/CD.o:(.rodata._ZTVN5Music2CDE[vtable for CD]+0x10)||undefined reference to ` CD::getPrice()'|
obj/Debug/Store/CD.o:(.rodata._ZTVN5Music2CDE[vtable for CD]+0x14)||undefined reference to ` CD::setPrice(double)'|
obj/Debug/Store/CD.o:(.rodata._ZTVN5Music2CDE[vtable for CD]+0x20)||undefined reference to `non-virtual thunk to CD::getPrice()'|
obj/Debug/Store/CD.o:(.rodata._ZTVN5Music2CDE[vtable for CD]+0x24)||undefined reference to `non-virtual thunk to CD::setPrice(double)'|
obj/Debug/Store/CD.o:(.rodata._ZTIN5Music2CDE[typeinfo for CD]+0x10)||undefined reference to `typeinfo for MusicProduct'|
obj/Debug/Store/CD.o:(.rodata._ZTIN5Music2CDE[typeinfo for CD]+0x18)||undefined reference to `typeinfo for Product'|
||=== Build finished: 6 errors, 5 warnings ===|
このコードの何が問題になっていますか?