#include
#include
using namespace std;
class Book {
public:
Book(char *title, char *publisher, char *author);
void show_book(void) {
cout << "Book: " << title << " by " <<
author << " Publisher: " << publisher << endl;
};
operator char *();
private:
char title[64];
char author[64];
char publisher[64];
};
Book::Book(char *title, char *publisher, char *author)
{
strcpy(Book::title, title);
strcpy(Book::publisher, publisher);
strcpy(Book::author, author);
}
Book::operator char *(void)
{
char *ptr = new char[256];
return(strcpy(ptr, title));
}
int main(void)
{
Book myBook("A", "B","C");
char *title;
title = myBook;
cout << "The book's title is " << title << endl;
}