Posted by: Sourav | September 4, 2016

Override tostring in vb,VB Teacher Sourav,Kolkata 09748184075


Option Strict On
Option Explicit On
Imports System

Module Module1

Sub Main()
Dim s1 As sample = New sample
s1.manipulatefirstname = “Sourav”
s1.manipulatelastname = “Bhattacharya”
Console.WriteLine(s1.ToString())
Console.ReadLine()

End Sub

End Module
Public Class sample
Private firstname As String
Private lastname As String
Public Property manipulatefirstname() As String
Get
Return Me.firstname
End Get

Set(ByVal firstname As String)
Me.firstname = firstname

End Set
End Property
Public Property manipulatelastname() As String
Get
Return Me.lastname
End Get

Set(ByVal lastname As String)
Me.lastname = lastname

End Set
End Property
Public Overrides Function ToString() As String
Return Me.firstname+” “+Me.lastname

End Function
End Class

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: