I am working on some tennis project and I need to return some data from a function. I created two classes:
Public Class Player
Public Name As String
Public Age As Integer
End Class
..and
Public Class tennisMatch
Public Surface As String
Public matchDate As Date
Public Player1 As Player
Public Player2 As Player
End Class
I want to have a function that returns an instance of tennisMatch
so I can use it later, I tried this:
Public Function getMatch() As tennisMatch
Dim Match As New tennisMatch
Dim Player1 As New Player
Player1.Name = "Steve"
Match.Surface = "Clay"
Return Match
End Function
Now, this works:
Console.WriteLine(getMatch.Surface)
However, this doesn't:
Console.WriteLine(getMatch.Player1.Name)
What am I doing wrong?