im getting better at all this stuff. i can fix most of my errors on my own. but im getting linking errors now and i have no clue how to fix them. anybody know whats wrong with this?
heres my errors im getting:
Ch09Ex02.obj : error LNK2001: unresolved external symbol "public: void __thiscall NonFiction::showNonFiction(void)" (?showNonFiction@NonFiction@@QAEXXZ)
Ch09Ex02.obj : error LNK2001: unresolved external symbol "public: void __thiscall Fiction::showFiction(void)" (?showFiction@Fiction@@QAEXXZ)
Debug/Ch09Ex02.exe : fatal error LNK1120: 2 unresolved externals
Code:
#include<iostream.h>
#include<string.h>
class Book
{
protected:
char Title[20];
char Author[20];
public:
void getData(const char title[20], const char author[20]);
void showData();
};
class Fiction:public Book
{
private:
int readingLevel;
public:
void getData(const char title[], const char author[], const int level);
void showFiction(void);
};
class NonFiction:public Book
{
private:
int numPages;
public:
void getData(const char title[], const char author[], const int pages);
void showNonFiction(void);
};
void Fiction::getData(const char title[], const char author[], const int level)
{
strcpy(Title,title);
strcpy(Author, author);
readingLevel=level;
}
void NonFiction::getData(const char title[], const char author[], const int pages)
{
strcpy(Title, title);
strcpy(Author, author);
numPages=pages;
}
void main()
{
Fiction novel;
NonFiction manual;
novel.getData("Scarlet Letter","Hawthorne",10);
manual.getData("Log Cabin Building","Landers",328);
novel.showFiction();
manual.showNonFiction();
}