2019-04-29
阅读量:
370
python如何向散列添加属性
Perl中的属性存储为散列引用中的键值对。此外,向代码添加一些属性。
package Area;
sub new
{
my $class = shift;
my $self =
{
length => 2, # storing length
width => 3, # storing width
};
return bless $self, $class;
}
1;
上面的代码(AreaClass)有两个属性:length和width。






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论