()选择Warning() As String项(可以忽略其他选项)并按下Return看看所创建代码的功能如何删除当前的回车行并添加一个新行
Public Overrides Function Warning() As String
Return No warning youll have to shout yourself
End Function
()保存并关闭该类文件
()创建一个名为Inheritance aspx的新Web Form添加个按钮和个标签确保紧靠Wheels的标签为Labell紧靠Speed的标签为Labe紧靠Warning的标签为Labe可以使用按钮的Text属性修改按钮上的文本显示
()为这个按钮创建Click事件的事件处理程序对于Car按钮
Protected Sub Button_Click(ByVal sender As Object ByVal e As SystemEventArgs) Handles ButtonClick
Dim myTransport As New Car()
LabelText = myTransportWheelsToString()
LabelText = myTransportTopSpeedToString()
LabelText = myTransportWarning()
End Sub
()对Bike按钮
Protected Sub Button_Click(ByVal sender As Object ByVal e As SystemEventArgs) Handles ButtonClick
Dim myTransport As New Bike()
LabelText = myTransportWheelsToString()
LabelText = myTransportTopSpeedToString()
LabelText = myTransportWarning()
End Sub
()对Skateboard按钮
Protected Sub Button_Click(ByVal sender As Object ByVal e As SystemEventArgs) Handles ButtonClick
Dim myTransport As New Skateboard()
LabelText = myTransportWheelsToString()
LabelText = myTransportTopSpeedToString()
LabelText = myTransportWarning()
End Sub
()在Solution Explorer中右击Inheritanceaspx从该菜单中选择Set As Start Page
()按下F键运行该页面单击这个按钮注意标签上面显示的内容
[] [] [] [] [] []