Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBScript - Building upon a base class.

$
0
0
I have a Class ‘VBS’ with 3 properties and a
Get & Let Method for each property.
Option Explicit

Public VBS

Class VBSObject
'--------------    
    Private MyTitle, _
            MyCopyright, _
            MyVersion
    
    Private Sub Class_Initialize()
            MyTitle          = "VBS Object"
            MyCopyright      = "2013"
            MyVersion        = "01-0000"
    End Sub
    Private Sub Class_Terminate()
    End Sub
    Public Default Property Get Title
           Title = MyTitle    
    End Property              
    Public Property Get Copyright
             Copyright = MyCopyright    
    End Property              
    Public Property Get Version
           Version = MyVersion    
    End Property
    Property Let Title(StrTitle)
           MyTitle = StrTitle
    End Property
    Property Let Copyright(StrYear)
           MyCopyright = StrYear    
    End Property
    Property Let Version(StrVersion)
           MyVersion = StrVersion    
    End Property
End Class

Private Sub Initialize()
'-----------------------
    Set VBS = New VBSObject
End Sub

Initialize
I can use:
MsgBox VBS.Title            ‘ Displays: VBS Object
MsgBox VBS.Copyright   ‘ Displays: 2013
MsgBox VBS.Version       ‘ Displays: 01-0000

I would like to create a new Class ‘VMS’ that has
these properties and methods, but, adds 3 more methods.

Function Name()
Function FullName()
Function Path()

So I can use:
MsgBox WSH.Title
MsgBox WSH.Copyright
MsgBox WSH.Version
MsgBox WSH.Name
MsgBox WSH.FullName
MsgBox WSH.Path

Is there a way of doing this without copying the code
Into the new Class ‘VMS’.

Thanks,
Raney



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>