#include
"
using namespace std;
class CString //class containing a string and functions to access the string
{
public:
CString(char *p); // allocates memory and copies p to m_pString
virtual ~CString(); // deletes the m_pString
char *GetString(){return m_pString ;} //inline function is already implemented
virtual ConvertString(){ cout << "nothing\n" ;} //inline function is done here
private:
char *m_pString; // the character data string
};
class CNumericString : public CString //derived from CString
{ //contains the numeric value of its base
public:
CNumericString(char *p); //its base constructor is initialized from here
~CNumericString(); // does nothing
int ConvertString(); // Converts the string of its base class to integer,
// using atoi and saves it
// in m_numericString.
private:
int m_numericString; // the numeric string of its base
};
void main()
{
CNumericString str("12345");
cout << str.GetString() << endl;
cout << str.ConvertString() << endl;
}
