J
Joe Fallon
1. I have a Base class that has a certain amount of functionality.
2. Then I have a CodeSmith generated class that inherits from the Base class
and adds functionality.
3. Since I want to be able to re-generate the classes on level 2 I have a
3rd level that inherits from them and implements specific hand coded
methods.
4. My colleague asked me to create a 4th level class that inherits the 3rd
level class so he can write custom functionality that overrides the "plain"
functionality at all levels above it.
I have 1-3 implemented as Shared methods.
To me, this enables simpler UI code.
For example:
strSQL = Level3ClassName.Select
In this way I do not need to instantiate an instance of the class I just use
the shared methods in levels 1-3.
===========================================================
My problem (other than being new and not really understanding this well
enough yet <g> )
is I don't know how to implement Level 4 in a way that allows me to use
Shared methods in levels1-3 and yet Override them in Level 4.
Is it not possible?
==============================================================
If I have to change Levels 1-3 what would you recommend?
================================================
Sample code:
Level 1
Public MustInherit Class Base
Public Shared Function DoSomething(ByVal Source As String) As String
End Function
================================================
Level 2
Public MustInherit Class GeneratedStuff
Inherits Base
Public Shared Function DoSomethingElse(ByVal Source As String) As String
End Function
================================================
Level 3
Public MustInherit Class HandCodedStuff
Inherits GeneratedStuff
Public Shared Function IWroteThis(ByVal Source As String) As String
End Function
================================================
Level 4 (implements same functionality as Level 3 but also allows customized
changes by overriding methods or creating new ones that are specific to a
single client. Level 3 functionality is for all clients.)
Public MustInherit Class FinalLevel
Inherits HandCodedStuff
Overrides Function DoSomethingElse(ByVal Source As String) As String
End Function
Thanks for any advice!
2. Then I have a CodeSmith generated class that inherits from the Base class
and adds functionality.
3. Since I want to be able to re-generate the classes on level 2 I have a
3rd level that inherits from them and implements specific hand coded
methods.
4. My colleague asked me to create a 4th level class that inherits the 3rd
level class so he can write custom functionality that overrides the "plain"
functionality at all levels above it.
I have 1-3 implemented as Shared methods.
To me, this enables simpler UI code.
For example:
strSQL = Level3ClassName.Select
In this way I do not need to instantiate an instance of the class I just use
the shared methods in levels 1-3.
===========================================================
My problem (other than being new and not really understanding this well
enough yet <g> )
is I don't know how to implement Level 4 in a way that allows me to use
Shared methods in levels1-3 and yet Override them in Level 4.
Is it not possible?
==============================================================
If I have to change Levels 1-3 what would you recommend?
================================================
Sample code:
Level 1
Public MustInherit Class Base
Public Shared Function DoSomething(ByVal Source As String) As String
End Function
================================================
Level 2
Public MustInherit Class GeneratedStuff
Inherits Base
Public Shared Function DoSomethingElse(ByVal Source As String) As String
End Function
================================================
Level 3
Public MustInherit Class HandCodedStuff
Inherits GeneratedStuff
Public Shared Function IWroteThis(ByVal Source As String) As String
End Function
================================================
Level 4 (implements same functionality as Level 3 but also allows customized
changes by overriding methods or creating new ones that are specific to a
single client. Level 3 functionality is for all clients.)
Public MustInherit Class FinalLevel
Inherits HandCodedStuff
Overrides Function DoSomethingElse(ByVal Source As String) As String
End Function
Thanks for any advice!