Country - Introduces a simple Country-object (/examples)
1.00
use Country; $co=Country->new(); $co->set_name('the name of this country'); $city_object=$co->get_a_has_capital();
Rumbaugh uses this simple example to illustrate a one-to-one association between a Country- and a City-object in ch. 3.2 of "Object Oriented Modelling".
The idea is that any instance of a Country-class can access all functions of the associated City-class VIA the association (and vice versa). The one-to-one association introduces a lot of flexibility and functionality into object-oriented design.
There are many ways to implement this one-to-one association. The author decided to use an internal instance variable $a_has_capital. It than is the task of the program, which uses Coutry.pm, to establish a correct association with a correct city.
perldoc associated perldoc City.pm
Name: Michael Schlueter
email: mschlue@cpan.org
Copyright (c) 2000, Michael Schlueter. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
To install Class::Classgen::New, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Classgen::New
CPAN shell
perl -MCPAN -e shell install Class::Classgen::New
For more information on module installation, please visit the detailed CPAN module installation guide.