This is supposed to create a class that inherits from the STL string class and use it to find word palindromes. I originally wrote it without the Pstring class as a simple function and it worked fine. I am sure I am just too close to the wall to see the paint right now but if anyone can see why I get the following error during build I would appreciate it.
1>Source.obj : error LNK2019: unresolved external symbol "public: __thiscall Pstring::Pstring(void)" (??0Pstring@@QAE@XZ) referenced in function _main
1>C:\Users\Bobby\Spring 2013\CSIS 297\Visual Studio\Palindrome\Debug\Palindrome.exe : fatal error LNK1120: 1 unresolved externals
#include <iostream>
#include<iomanip>
#include <string>
usingnamespace std;
//Classes
class Pstring : public string // inherit fm STL
{
private:
string input;
public:
bool isPalindrome();
Pstring();
};
int main()
{
Pstring entry;
cout << "Enter a word and I will tell you if it is a Palindrome ";
cin >> entry;
cout << "Your entry is "<< entry.isPalindrome();
system ("pause");
return 0;
}
bool Pstring::isPalindrome()
{
bool yes = false;
int size = this->input.size();
for ( int i=0; i < (size/2); i++)
{
if (toupper(input[i]) == toupper(input[size-1-i]))
{
yes = true;
cout << input[i];// test output to see the action of the loop
}
else
yes = false;
}
cout << yes;];// more test output(will be replaced with message)
return yes;
};