package MyTest;
use strict;
sub new
{
my $pkg = shift;
my $obj = {
'value' => 0,
'is_null' => 1
};
bless $obj,$pkg;
return $obj;
}
sub setValue
{
my $obj = shift;
my $value = shift;
$obj->{'value'} = $value;
$obj->{'is_null'} = 0;
}
sub getValue
{
my $obj = shift;
return $obj->{'value'};
}
sub isNull
{
my $obj = shift;
return $obj->{'is_null'};
}
return 1;
|
<?php
class MyTest
{
var $value;
var $is_null;
function MyTest()
{
$this->value = 0;
$this->is_null = true;
}
function setValue($value)
{
$this->value = $value;
$this->is_null = false;
}
function getValue()
{
return $this->value;
}
function isNull()
{
return $this->is_null;
}
}
?>
|