in reply to Re: Inheritance via class::derived_method Question
in thread Inheritance via class::derived_method Question

The 'inheritance mechanism' is the -> operator,

No. The inheritance mechanism applies to method calls. Few of the -> operators have anything to do with methods. For example,

$x->[0]

Furthermore, not all method calls use the -> operator. For example,

new Foo

Forms of method calls:

$class->method(LIST) # Static method call. $object->method(LIST) # Instance method call. $x->Class::method(LIST) # Pretend the LHS is class "Class". $x->SUPER::method(LIST) # Pretend the LHS is its super class. method $x LIST; # Indirect method syntax

I think that's all of them.

Horse::speak("Horse") is a sub call. Subroutines aren't inherited. Subroutines don't have classes, so subroutines don't have parent classes, so subroutines have nothing from which they could inherit.

Replies are listed 'Best First'.
Re^3: Inheritance via class::derived_method Question
by How09 (Novice) on Nov 20, 2010 at 06:26 UTC

    Thanks for the help. I think I'm getting a feel for it now.

    class::method();

    Is more like a name which is either defined or not.
    There is no @class::ISA array search for "method".
    There is no "automatic" first argument=class passed to the method.

    class->method();

    dereferences class for "method" and if not found will then use the "special method lookup mechanism" to search the classes listed in the @ISA array for "method"
    The class name is automatically passed to "method" as the 1st argument.

    -----
    Fairly close?
    Thanks again.

      There is no @class::ISA array search for "method".

      Correct, because you're not calling it as a method.

      There is no "automatic" first argument=class passed to the method.

      Correct, because you're not calling it as a method.

      class->method(); dereferences class for "method"

      Incorrect terminology, but yes. class->method() calls Class's method method, using inheritance if necessary.