#include #include // class declaration class Book { private: char *title; // a pointer to a book title public: Book(char * = NULL); // constructor void showtitle(); // display the title }; // class implementation Book::Book(char *strng) { title = new char[strlen(strng)+1]; // allocate memory strcpy(title,strng); // store the string } void Book::showtitle() { cout << title << endl; return; } int main() { Book book1("DOS Primer"); // create 1st title Book book2("A Brief History of Western Civilization"); // 2nd title book1.showtitle(); // display book1's title book2.showtitle(); // display book2's title return 0; }