Main Content

Associative objects - one object within another.

Archive - Originally posted on "The Horse's Mouth" - 2016-01-20 17:13:22 - Graham Ellis

A new demonstration of the use of objects within objects - [here] from today's PHP course.

Faced with a class of public transport departure times (as strings) and run times (in pinutes), I added a class of time objects so that I could encapsulate the calculations of time into their own class.

It's a very common practise to use objects within objects ... simply not done too often with our own objects on a training course due to pressure of time!