Help for this page

Select Code to Download


  1. or download this
    package GenObj;
    
    ...
    $foo = GenObj->new;
    $foo->setname("Jeff");
    print $foo->name;
    
  2. or download this
    $x = new GenObj;       # ref($x) eq 'GenObj::a'
    $y = new GenObj -foo;  # ref($y) eq 'GenObj::b'
    $x->get_foo;           # calls $x->GenObj::get_foo
    $y->get_foo;           # calls $y->GenObj::b::get_foo
    
  3. or download this
    package GenObj;
    
    ...
    sub sec2age;
    
    1;
    
  4. or download this
    use GenObj;
    my $normal   = new GenObj;
    ...
    
    $diffboth->set_age(10);  # GenObj::Sub::set_age
    $diffboth->get_name;     # GenObj::Sub::get_name