|
|
|
Who is this for What you should know Object Oriented Programming Concepts Introduction Object Oriented Programming
Concepts
Perl Implementation of OOP
Don't be overwhelmed with these terms, you can interchange the terms. When we say class, we actually mean a Perl package. When we say method, we actually mean function, etc. Although you are free to use any method name to initialize your object, you should use new instead. This keeps it consistent with the C++ programming style. If you will be the only one touching your program, you can use any name. If not, be nice to the one who will revise your program, use the standard new method. @ISA Array If you have say, a city class built on top of a province class, you need an item in the @ISA array in the city class with the value of province. Should a function call a method in your class, Perl will first search for the method within your class. If the method is not in your class, it goes to the @ISA array to find any defined parent class. If your class was built on top of a base class, Perl goes to that class and looks for the method there. Sample
Program package province; { sub new {
The copyright of the article Perl Packages Part 5 (Object oriented programming) in Perl is owned by . Permission to republish Perl Packages Part 5 (Object oriented programming) in print or online must be granted by the author in writing.
|
|
|
|
|
|
|
|