|
Using
a global variable and then calling the parent as you've done IMHO violates the
principle of encapsulation. In your example, a much better idea would be to pass
"description" as an argument. Here's a more real world
situation:
I want
to create a SalariedEmployee. In order to do so, I want to create a generic
Employee first and get an employeeID returned to me. With that information, I
can then fill in the part that's specific to a SalariedEmployee. When I want to
create a new SalariedEmployee, I first call SuperQ(). Same with
ContractEmployee. The idea is that HourlyEmployee, SalariedEmployee, and
ContractEmployee are all types of Employee and I want to abstract the code
common to all three types of employees to the super type, Employee, so that I
don't have code duplication.
This
is how Super() is used most commonly in languages like Smalltalk and Java. In
the case I describe, I definitely want the parent's fuseaction to run in the
context the architect intended it to be. What you're describing is a sort of
reverse inheritance where the parent inherits from the child. That is downright
funky. However, I will take you up on the brandy and fine Cuban cigars.
;-)
==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================ |
Title: Message
- RE: SuperQ functionality with the STANDARD core (Re... BORKMAN Lee
- RE: SuperQ functionality with the STANDARD cor... BORKMAN Lee
- Re: SuperQ functionality with the STANDARD... David Huyck
- RE: SuperQ functionality with the STANDARD... hal helms
- Re: SuperQ functionality with the STAN... John Quarto-vonTivadar
- RE: SuperQ functionality with the STANDARD cor... BORKMAN Lee
- RE: SuperQ functionality with the STANDARD cor... BORKMAN Lee
- RE: SuperQ functionality with the STANDARD cor... BORKMAN Lee
- RE: SuperQ functionality with the STANDARD... hal helms
- Re: SuperQ functionality with the STAN... Lee Borkman
- RE: SuperQ functionality with the STANDARD cor... Roger B.
