Shelgeyr wrote:
How about ...
5 BadgerCount = 0
6 MushroomCount = 0
...
Sorry, not enterprisey enough.
Code:
'Basic animal structure with implemented subclasses.
'Eventually will migrate to Oracle backend
Public Enum AnimalType As Integer
Badger
Snake
Mushroom 'vlad - added 3/29/12 per compliance, yes we know it's not an animal
End Enum
'2/1/10 coding standards mandate abstraction
Public MustInherit Class Animal
Friend atTypeName As AnimalType
Friend strNoise As String
Public MustOverride ReadOnly Property TypeName() As AnimalType
Public MustOverride ReadOnly Property Noise() As String
End Class
Public Class Badger
Inherits Animal
Public Sub New(ByVal TypeName As AnimalType, ByVal Noise As String)
atTypeName = TypeName
strNoise = Noise
End Sub
Public Overrides ReadOnly Property TypeName() As AnimalType
Get
Return AnimalType.Badger 'todo remove hardcode
End Get
End Property
Public Overrides ReadOnly Property Noise() As String
Get
Return strNoise
'Return "Badger." '11/7/10 removed hardcoding
End Get
End Property
End Class
Public Class AnimalFactory
Implements IEnterpriseCreatureFactory
Public Function CreateAnimal(ByVal eAnimalType As AnimalType) As Animal
Select Case eAnimalType
Case AnimalType.Badger
Return New Badger(AnimalType.Badger, "Badger.")
Case AnimalType.Snake
'Return New Snake(AnimalType.Snake, "Snake.")
Case AnimalType.Mushroom
'todo add mushroom
End Select
End Function
End Class