Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Overload design when two different types of object
Message
From
05/09/2006 19:26:19
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Overload design when two different types of object
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01151161
Message ID:
01151161
Views:
83
Lets say I have a class which contains those two properties:
        Private oApp As Framework.App
        Private oProcess As Framework.LXProcess
Then, the New() event supports overload such as this:
        ' This is when we access the data provider in desktop and Web service mode
        Sub New(ByVal toApplication As Framework.App)
            oApp = toApplication
        End Sub

        ' This is when we access the data provider in a Web mode
        Public Sub New(ByVal toProcess As Framework.LXProcess)
            oProcess = toProcess
        End Sub
Then, one method of this class is like this:
        ' Return the field size
        ' expC1 Table
        ' expC3 Connection string
        Public Function GetSchema(ByVal tcTable As String, ByVal tcConnectionString As String) As Boolean
            Dim loDataProvider As Framework.Data = New Framework.Data(oApp)
            loDataProvider.nSQLMode = nSQLMode
            If Not loDataProvider.GetSchemaTable(tcTable, tcConnectionString) Then
                Return False
            End If
            oDataTable = loDataProvider.oDataTable
            Return True
        End Function
However, in this method, when loDataProvider is created, the Framework.Data class also supports overloads. So, basically, if I instantiated this class by passing oApp, I need to have the declaration in this method to be:
            Dim loDataProvider As Framework.Data = New Framework.Data(oApp)
But, if I instantiated this class by passing oProcess, I need to have the declaration in this method to be:
            Dim loDataProvider As Framework.Data = New Framework.Data(oProcess)
Both lines would work and this is ok. However, in the GetSchema() method, how one would adjust the code to support that?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform