'Parent Class
Public Class Price
'Conststans
Private Const Sandwich_1 As Decimal = 3.0
Private Const Sandwich_2 As Decimal = 3.5
Private Const Sandwich_3 As Decimal = 3.95
Private Const Sandwich_4 As Decimal = 4.5
Private Price As Decimal
'Child Class
Public Class Sandwiches
'We start inheritance by using this keyword.
'It allows us to integrate (use) the Parent'
'Class variables , properties , methods in
'this Child Class . You have also MustInherit
'directive which forces child to inherits Parent
'Class ..etc .See list for these keywords and
'discription for each one in the Help Files
Inherits Price
Public Sandwich_ID As Decimal
Public Enum Sandwiches_en
GLINDA = 1
THE_Wicked = 2
Hagatha = 3
Burt = 4
End Enum
Public Function SandwichesFunction(ByVal Index As Sandwiches_en) As Decimal
If Index = Sandwiches_en.GLINDA Then
'See here : We are able to see the Private variables
'of the Parent Class and we can Get or Set
'its value , moreover all Methods, Properties
'of the Parent Class no matter they are
'Private of Public , they are still
'accessible from anywhere in out Child
'Class.This applies to the below code also
Sandwich_ID = MyBase.Sandwich_1
Return Sandwich_ID
ElseIf Index = Sandwiches_en.THE_Wicked Then
Sandwich_ID = MyBase.Sandwich_2
Return Sandwich_ID
ElseIf Index = Sandwiches_en.Hagatha Then
Sandwich_ID = MyBase.Sandwich_3
Return Sandwich_ID
ElseIf Index = Sandwiches_en.Burt Then
Sandwich_ID = MyBase.Sandwich_4
Return Sandwich_ID
End If
End Function
End Class
End Class