| Class-Classgen-classgen documentation | Contained in the Class-Classgen-classgen distribution. |
Point - A simple demo for a one-to-many association (/examples).
1.00
Points will be used by Polygons. Point-instances can retrieve their bolonging Polygon-instance via the $a_belongs_to internal variable. They can even start functions of the Polygon-class via this association.
perldoc classgen perldoc many perldoc Polygon
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.
| Class-Classgen-classgen documentation | Contained in the Class-Classgen-classgen distribution. |
# --- Generated by classgen 3.03 on Fre Dez 29 21:56:41 MET 2000 --- $VERSION=1.00; package Point; ; require 'Point_gs.pm'; sub new { my ($self) = @_; # instance-variables: my $x; # coordinate my $y; # coordinate my $a_belongs_to; # a 'belong to' association $self=bless { _x => $x, _y => $y, _a_belongs_to => $a_belongs_to, }, ref($self)||$self; #$self->inherit_from($self->your_base::new()); # adapt when inheriting return $self; } # --- methods specific for this class --------------------- sub specific { my ($self) = @_; } # --- inheritance methode ----------------------------------- sub inherit_from { my ($self, $base_blessed) = @_; my @l = keys %$base_blessed; foreach (@l) { $self->{$_} = $base_blessed->{$_}; } } 1; __END__