COS110 Tutorial5-MEMO

COS110 Tutorial5-MEMO - COS 110 Tutorial 5 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 5 Department of Computer Science 24 August Answer the questions in the spaces provided on the question sheets. Name and Surname: Student Number: Employee number : Venue : 1. Consider the following: class MyArrayClass { public: MyArrayClass(int*& el, char*& dis, int num); MyArrayClass(); int* getElements() const; void setDiscription(char*& dis); char* getDiscription() const; 2. Declaration goes here private: int* elements; char* Discription; int numberOfElements; 1. Declaration goes here }; 1 (a) Implement a mechanism to keep count of the total numbers of elements that that are stored in the arrays elements of all the objects of MyArrayClass. This mechanism must also be available even when there is no instantiated objects of type MyArrayClass . To do this add a variable to keep track of the number of elements and create a member function that will be called when a new MyArrayClass object is created with the numbers of elements that the new MyArrayClass has. When the member function is called print out the number. Hint: They are numbered 1 and 2 in the code above.are numbered 1 and 2 in the code above....
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 / 4

COS110 Tutorial5-MEMO - COS 110 Tutorial 5 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