Michael Schlüter > Class-Classgen-classgen-3.03 > City

Download:
Class-Classgen-classgen-3.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View Bugs
Report a bug
Module Version: 1   Source  

NAME ^

City - Introduces a simple City-object (/examples)

VERSION ^

1.00

SYNOPSIS ^

        use City;
        $ci=City->new();
        $ci->set_name('the name of this city');
        $country_object=$ci->get_a_is_capital_from();

DESCRIPTION ^

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 City-class can access all functions of the associated Country-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_is_capital_from. It than is the task of the program, which uses City.pm, to establish a correct association with a correct country.

ENVIRONMENT ^

DIAGNOSTICS ^

BUGS ^

FILES ^

SEE ALSO ^

        perldoc associated
        perldoc Country.pm

AUTHOR ^

Name: Michael Schlueter

email: mschlue@cpan.org

COPYRIGHT ^

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.