August 1997
OP216: OBJECT ORIENTED PROGRAMMING

QUESTION 1 (Compulsory)

Total Marks: 20 Marks

Click here to access other questions

Click to access
SUGGESTED SOLUTIONS
for Question 1

1. (a) What is the difference between public and private data members? [4]
(b) Use C++ to describe the header of a function called MEOW. MEOW is a member of the class cat but is defined outside it. MEOW takes no parameters and returns void. [2]
(c) Use C++ to show the declaration of a class square that derives from rectangle, which in turn derives from shape [3]
(d) When is copy constructor called and when is a destructor called? [4]
(e) Differentiate between the following:
(i) class and object [2]
(ii) method and message [2]
(f) List the three types of inheritance. [3]