cpp
#include <iostream>
#include <stack>
#include <string>
using namespace std;
class Pstring : public string
{
public:
Pstring(string revWrd);
bool isPalindrome(string ip);
};
bool isPalindrome(string revWrd)
{
int test;
int left = 0;
int right = revWrd.size()-1;
int length = left;
while (test != length)
{
test++;
if ((revWrd[left] != revWrd[right]))
return false;
else
return true;
left++;
--right;
}
}
int main()
{
string word;
bool palindrome;
Pstring palindromeTested(word);
cout << "Enter a word or sentence to have it\n";
cout << "reversed and tested if it is a palindrome: ";
getline(cin, word);
palindrome = palindromeTested.isPalindrome(word);
if(palindrome==true)
cout<<"This is a palindrome"<<endl;
else
cout <<"That was not a palindrome";
return 0;
}
i get 2 error codes which are 1 "undefined reference to `Pstring::Pstring(std::__cxx11::basic_string, std::allocator >)'|" and 2 "undefined reference to `Pstring::isPalindrome(std::__cxx11::basic_string, std::allocator >)'|