#!/usr/bin/perl

use strict;
use warnings;

package AtestClass;     #namespace and therefore class name

sub new{ #Constructor, can have ANY name, but convention is 'new'
    my $class = shift;	#when called we are called with the class name
                        # convention says use $class and $self as names
    my $self = {};      #create an anonymous hash where this object
                        # will store its data
    bless $self,$class;	#this is to be an object of the class, bless it 
                        # it into the class
    return $self;       #and return the object reference
}

sub getSet{ #set or get an attribute of the current object
    my $self = shift;	#the first argument is the object reference

    my $what = shift;	#what to set/get, they key

    if (@_) {       #there is a value to set, ie a remaining arg
        $self->{"$what"} = shift; #so set it into the hash
    }
    return($self->{$what}); #what we set or retrieved
}
1;
