Learning inheritance in C ++

xiaoxiao2021-03-02  62

// Learn inheritance in C // WriteD by Swords 2005/3/15

#include #include class book {public: book (char * title) {structure (book :: title, title);}; void show_title (void) {cout << title << Endl;}; private: char Title [64];

class LibraryCard: public Book {public: LibraryCard (char * title, char * author, char * publisher): Book (title) {strcpy (LibraryCard :: author, author); strcpy (LibraryCard :: publisher, publisher);}; Void show_library (void) {show_title (); cout << author << '' << publisher;}; private: char author [64]; char Publisher [64];

Void main (void) {librarycard card ("Jamsa's C / C Programmer's Bible", "Jamsa and Klander", "Jamsa Press"); card.show_library ();}

转载请注明原文地址:https://www.9cbs.com/read-31607.html

New Post(0)