in reply to Not quite an OO tutorial

I think this is a great tutorial on how OO and inheritance work within perl; however, I don't think this is a great example of inheritance. This would be akin to making a vector class, then having specialized vectors that simply initialize the list with a different set of items.

A more sane approach would be to simply use the base class and pass it the list directly. The module could also provide pre-created instances or creator methods for convenience. In fact, you already show that with the $tense object.

Replies are listed 'Best First'.
Re^2: Not quite an OO tutorial
by GrandFather (Saint) on Feb 23, 2011 at 19:35 UTC

    Indeed! Inheritance is an occasional thing and finding good succinct examples is hard. However the example isn't quite as bad as a first glance may suggest. The virtue in providing derived classes here is that you don't have to repeat the same list of values if you want to use the same object type in multiple places. There are however many other ways much the same result could be could be achieved that don't require OO let alone inheritance.

    True laziness is hard work