Override the method toString()

  • Thread starter Thread starter portroe
  • Start date Start date
P

portroe

How Do i override the method toString()?

Now it should return a string representation of an object, with various
variables such as Lastname, Age and Marital status

thanks

Portroe
 
* portroe said:
How Do i override the method toString()?

Now it should return a string representation of an object, with
various variables such as Lastname, Age and Marital status

\\\
Public Overrides Function ToString() As String
Return _
m_LastName & ", " & _
m_Age.ToString() & ", " & _
m_Married.ToString()
End Function
///
 
Public Class MyTest
Dim name As String = "Your Name"

Public Overrides Function ToString() As String
Return name
End Function

End Class
 
Back
Top