COS110 Tutorial7-Memo

COS110 Tutorial7-Memo - COS 110 Tutorial 7 Department of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COS 110 Tutorial 7 Department of Computer Science 31 August MEMO The ticks represent 1 mark. In the coding answers the mark is given in [] for each line to mark. 1. Consider the following code: class Book { private: int isbn; char* name; char* publisher; char* author; public: Book(); Book(int isbnI, char*& nameI, char*& publisherI, char*& authorI); }; class TextBook { private: int isbn; char* name; char* publisher; char* author; char* course; public: TextBook(int isbnI, char*& nameI, char*& publisherI, char*& authorI,char*& courseI); }; 1 (a) (3) Provide code to enable the following (The function signature is also required) Book b; Textbook tb; b = tb; Solution: Book::operator Textbook() [1] { course = new char[10]; [1] TextBook(isbn,name,publisher,auther,course); [1] } (b) (7) Change the code of TextBook to make it inherited from Book. All necessary code for Text- Book must be shown. No new function is required for TextBook. In Book some methods needs to be added. Only provide the function prototype for the methods of Book....
View Full Document

This note was uploaded on 02/27/2012 for the course IT 101 taught by Professor Unsure during the Spring '11 term at University of South Africa.

Page1 / 6

COS110 Tutorial7-Memo - COS 110 Tutorial 7 Department of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online