1.

How to reuse code explain with an example.

Answer»

Perl provides a reuse code ability which is called inheritance in this child CLASS can use the methods of the parent class.

Example

PACKAGE Parent;
Sub foo
    {
         print("INSIDE A::foo\n");
    }
 
package Child;
@ISA = (Parent);
package main;
Child->foo();
Child->bar();

 



Discussion

No Comment Found