Learning Perl Objects, References amp;amp; Modules [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Learning Perl Objects, References amp;amp; Modules [Electronic resources] - نسخه متنی

Randal L. Schwartz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید














8.9 What to Do with @_


In
that last example, had there been any additional parameters to the
speak routine (like how many times, or in what
pitch for singing, for example), the parameters would be ignored by
the Mouse::speak routine. If you want them to be
passed uninterpreted to the parent class, you can add it as a
parameter:

$class->SUPER::speak(@_);

This invokes the speak routine of the parent
class, including all the parameters that you've not
yet shifted off of your parameter
list.

Which one is correct? It depends. If you are writing a class that
simply adds to some of the parent class behavior,
it's best to simply pass along arguments you
haven't dealt with. However, if you want precise
control over the parent class behavior, you should determine the
argument list explicitly, and pass it.



/ 199