Create your own class with an internal collection of a different class. It should have methods for count
, add
, isFull
etc. Remember to write tests for your classes!
- A
Bus
class with an array,passengers
ofPerson
s. - A
Classroom
class with an array,students
ofPerson
s. - A
Library
class with an array,stock
, ofBook
s.
Add a third class which interacts with the other two. E.g. you could add a BusStop
with a method that takes a Bus
and moves Person
s from the BusStop
to the Bus
.