Skip to content

Instantly share code, notes, and snippets.

@StevenMeiklejohn
Created September 4, 2017 14:14
Show Gist options
  • Save StevenMeiklejohn/c67ad6d0698c9fcbc705bab9705c3882 to your computer and use it in GitHub Desktop.
Save StevenMeiklejohn/c67ad6d0698c9fcbc705bab9705c3882 to your computer and use it in GitHub Desktop.

Homework 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!

Some examples:

A Bus class with an array, passengers of Persons. A Classroom class with an array, students of Persons. A Library class with an array, stock, of Books. Extensions:

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 Persons from the BusStop to the Bus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment