in reply to Global Super Class (equivalent of java.lang.Object)
perl has class that is parent of all classes. It is called Universal. type `perldoc Universal` in your shell. You can insert any function in it. But you don't need to. Perl object model is much flexible relative to strict Java's. AFAIK, Java does not have multiple inheritance. Perl does.
There is no need for Univeral::as_string (Perl equivalent of toString()) method as you can simply call as_string of any object if his class supports it (and to know that you can use Universal::can). You can think that as_string is an interface.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global Super Class (equivalent of java.lang.Object)
by diotalevi (Canon) on Sep 26, 2006 at 15:20 UTC |