Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: inheritance turns back and bites

by John M. Dlugosz (Monsignor)
on Mar 01, 2004 at 16:13 UTC ( #332952=note: print w/ replies, xml ) Need Help??


in reply to inheritance turns back and bites

Nobody seems to have addressed the actual question, about the underlying reason for this being a mistake and how to avoid it.

Basically, you used the same method name in a derived class as is used in the base class, and that accidently overrides a function that just happens to have the same name but is used for a different purpose, takes different parameters, etc.

The first thing that comes to mind is to make sure all members are documented or follow a naming convention for "internal use" items. But, you can still hit that problem with an internal-use function! All methods that are called using the virtual dispatch mechanism, even those that are private, must be documented so a writer of a derived class is aware of them and will not re-use those names.

—John


Comment on Re: inheritance turns back and bites

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://332952]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2015-07-04 01:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls