troubleshooting Question

Multiple subs in class

Avatar of ToddHawley4984
ToddHawley4984 asked on
Microsoft Development
2 Comments1 Solution214 ViewsLast Modified:
I have been working through some examples in wrox visual basic 2008 book.  In developing classes there are some instances where the same sub name is used twice.  The author doesn't bother to explain why that is possible or how the calling sub knows which one to use...Can someone explain how you can use the same name for two different subs?  I've included one of the examples.  In this one there are two definitions for "Public Sub Save()...
Imports System.IO
Imports System.Xml.Serialization
Public Class SerializableData
    Public Sub Save(ByVal filename As String)
        'make a temporary filename....
        Dim tempFilename As String
        tempFilename = filename & ".tmp"
        'does the file exist
        Dim tempFileInfo As New FileInfo(tempFilename)
        If tempFileInfo.Exists = True Then tempFileInfo.Delete()
        'open the file
        Dim stream As New FileStream(tempFilename, FileMode.Create)
        'save the object
        'close the file
        'remove the existing data file and 
        'rname the temp file......
        tempFileInfo.CopyTo(filename, True)
    End Sub
    'Save  - actually perform the serialization....
    Public Sub save(ByVal stream As Stream)
        'create serializer
        Dim serializer As New XmlSerializer(Me.GetType)
        'save the file
        serializer.Serialize(stream, Me)
    End Sub
End Class
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros