Workshop
Quiz
1: | The first argument passed to an object method is always
|
2: | Can you have method names with the same names as built-in functions, or of already-defined subroutines?
|
3: | Does the constructor subroutine in a class have to be called new?
|
Answers
A1: | b. The reference that was blessed in the constructor is returned to each method. In this way the method gets a handle back to the object, and can use it to do its work. |
A2: | b. It's not really a problem because Perl can always tell that you meant the method—and not the built-in—because ... |
Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.