April 2000 QUESTION 4 Total Marks: 15 Marks |
Click here to access other
questions
Click to access |
An activity is something people invest their spare time in.An activity
has a name and a number of participants Consider the following definition
of the class Activity (a)Define what is meant by the term inheritance with respect to
object oriented (b)An exercise is a particular form of activity,with the added properties
of a (c)A hobby is also a particular form of Activity with the added attribute
of a Cost which is an integer.An implementation of the hobby class
would include these members,along with a constructor which took the
member attributes as parameters. If a sport is both a hobby and an
exercise then the class sport can be derived from the combination
of the two classes exercise and activity |