Public Class Tester
Public Shared Sub Main
Dim objHorse As Object
Dim objPuma As Object
objHorse = New Horse
objPuma = New Puma
Try
objHorse.Walk()
Catch
Console.WriteLine("Sorry, no Walk method available in objHorse.")
End Try
Try
objPuma.Walk()
Catch
Console.WriteLine("Sorry, no Walk method available in objPuma.")
End Try
End Sub
End Class
Public Class Horse
Public Sub Walk()
Console.WriteLine("Walking...")
End Sub
End Class
Public Class Puma
Public Sub Run()
Console.WriteLine("Running...")
End Sub
End Class
|