Object-InsideOut - Re: :Restricted methods imported into child classes?

Posted on Wed Jan 18 17:54:52 2006 by jdhedden in response to 1632 (See the whole thread of 9)
Re: :Restricted methods imported into child classes?
What you are describing is functions; not methods. Both are implemented as subroutines. Functions are invoked with just their name:
do_function($some_arg);
Methods are invoked via an object:
$obj->my_method($arg);
Methods are inherited, so you don't have to do anything extra to access a parent class's methods from a child class's objects.

To access functions outside of a class, you must either use a fully-qualified function name:
Parent::Class::some_function($an_arg);
Or you can use the Exporter module to export a function name into another class's namespace. Do 'perldoc Exporter' for how to do this.

Finally, ':Restricted' and ':Private' only work on method; not functions.
Direct Responses: 1638 | 1639 | Write a response