Main Content

Igloos melt in the summer, but houses do not

Archive - Originally posted on "The Horse's Mouth" - 2010-06-15 14:23:07 - Graham Ellis

In Germany, a house will grow in value over the years (perhaps current economic climate excluded) but an Igloo will loose all of its value in summer (it will melt!).From last week's Perl course, where I briefly covered object orientation in Perl (the course briefing only asked me to cover it briefly), I present [here] my Igloo and House example - defining classes of house and igloo, and providing different methods to get the value of each type after a number of years.

I also went on to separate out the class(es) from the main code in a further example - the main code is [here] and the extra classes are [here]. You'll note that I've inherited all classes from a base class thing into which I wrote an AUTOLOAD method. That way, I can set and get all my properties (attributes) of all the object types without having to write lots of accessor methods. Perl is REALLY neat, if a trifle unconventional at time!


Illustration - a variety of housing in Frankfurt ... but none of it is igloos!