Main Content

OO PHP demonstration - comparing objects and more

Archive - Originally posted on "The Horse's Mouth" - 2008-02-08 23:23:26 - Graham Ellis

Object Oriented PHP course today, and I though I would share an example I wrote during the course with you. Source code here and see it running here.

What does it show?

* A base class matching ... which is extended to a mactainer class, which is further extended to two further subclasses cube and cylinder.

* Polymorphism in the getvolume method

* "larger" and "largest" methods which show you how to compare 2 or more objects of a type (always an interesting subject for newcomers)