gpt4 book ai didi

perl - perl 中的@ISA 数组是什么?

转载 作者:行者123 更新时间:2023-12-03 21:10:24 27 4
gpt4 key购买 nike

our @ISA = "Critter";

我将在哪种情况下使用 @ISA ?

为什么 our @ISA ?.

最佳答案

为了扩展 Mat 的评论,在 perldocs 中广泛记录了这样的内容。 .

关于@ISA , here's what it says :

A Class is Simply a Package

...

Each package contains a special array called @ISA . The @ISA array contains a list of that class's parent classes, if any. This array is examined when Perl does method resolution, which we will cover later.

It is possible to manually set @ISA , and you may see this in older Perl code. Much older code also uses the base pragma. For new code, we recommend that you use the parent pragma to declare your parents. This pragma will take care of setting @ISA . It will also load the parent classes and make sure that the package doesn't inherit from itself.

However the parent classes are set, the package's @ISA variable will contain a list of those parents. This is simply a list of scalars, each of which is a string that corresponds to a package name.


our@ISA携手并进,因为 @ISA预计是一个包变量。

关于perl - perl 中的@ISA 数组是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14181570/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com