package TeacherFactory; use Teacher; use strict; sub create_teacher { my ($class, @args) = @_; return Teacher->new(@args); } 1;
That's the easy part; you have a pretty boring factory. Now make it interesting :)
Most likely, you may find that some calls to Teacher->new give you insufficient information to make the decision about whether a Lecturer or a teacher is required. Refactor your code *after* you have the above in place to either defer or advance the construction, depending on what makes more sense. But move in small steps that don't leave your code unstable.
In reply to Re^3: Inheritance and module cross dependencies
by gaal
in thread Inheritance and module cross dependencies
by prowler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |