我正在学习Visual Basic .NET(面试)。
我对正确的数据结构(可能是构造函数,结构或其他数据结构)有疑问。
例如,
我是VB.NET的初学者,所以我不确定如何以及如何设计数据结构。
如何解决这个问题?
答案 0 :(得分:1)
屏幕类型可以描述为枚举,其余使用类和属性,例如
Enum Screen
MonoChrome
Color
Both
End Enum
Class Channel
Property Number As Integer
Property Screen As Screen
End Class
MustInherit Class Channels
End Class
Class OneChannel
Inherits Channels
Property Channel As Channel
End Class
Class ThreeChannels
Inherits Channels
Property Low As Channel
Property Medium As Channel
Property High As Channel
End Class
Class Setting
Property First As Integer
Property Second As Integer
End Class
Class Frequency
Property Set_1 As Setting
Property Set_2 As Setting
Property Set_3 As Setting
Property Set_4 As Setting
Property Set_5 As Setting
Property Set_6 As Setting
Property Set_7 As Setting
End Class
Class TV
Property Channels As Channels
Property Frq_1 As Frequency
Property Frq_2 As Frequency
Property Frq_3 As Frequency
Property Frq_4 As Frequency
Property Frq_5 As Frequency
End Class
Module Module1
Sub Main()
Dim tvs(10) As TV
// ...
End Sub
End Module