>I have a class A whose "Init" method reads
>
>
>Line 1
>Line 2
>.
>.
>.
>Line 10 <-- (my subclass need a diff code for this line)
>.
>.
>.
>DODEFAULT()
>
>
>and B is a subclass of A. For B, in its "Init" method, I want to have everything the same as A's except for Line 10, but I can't figure out a good way to do that...
>
>I was thinking of copy all the codes in Init method of A and place them in Init method of B, then change Line 10 to whatever I want, but there is a problem in the last line -- DODEFAULT(). I can't place this as the last line in B's Init method (obviously, because I don't want to repeat lines in A's Init method), but I need to execute A's parent class Init method codes...
>
>What is the best way to achieve the above, would anyone give me a clue?
>
>Your suggestion will be very much appreciated.
Add a property to Class A, that would show you what part of code you should execute in Init event:
Line 1
Line 2
.
.
.
IF this.SomeProperty
Line 10 for YourClass B <-- (my subclass need a diff code for this line)
ELSE
Line 10 Normal Line 10
ENDIF
.
.
.
DODEFAULT()
Other Way, I don't like it because if you change something in Init of Class A you SHOULD change the same thing in Class B:
Copy and paste Init from Class A into Init of Class B:
Line 1
Line 2
.
.
.
Line 10 for YourClass B <-- (my subclass need a diff code for this line)
.
.
.
ClassAParentClass::Init()
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.