New class clsProcess

New class clsProcess

Anonymous
Not applicable
267 Views
1 Reply
Message 1 of 2

New class clsProcess

Anonymous
Not applicable
Hello to all: I have created a new class to that I call clsProcess (to drill, to weld, to paint etc.), this class can group a collection of Features of one or several parts or assemblies, my question is if I can associate this class to a file of Part or assembly and this clsProcess keeps all the characteristic to me from my new class. Thanks New class
0 Likes
268 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Hi,
I assume you're talking VB6 and Inheritance here?!
What you are looking for maybe the IMPLEMENTS feature of VB.
IMPLEMENTS can extend previous build classes, think of it like bottom up building of functionality.

maybe the following example may be of any use.
(Posted in Customer files too.)
Anton

'Class1: ----------------------------------------------
Option Explicit
Private m_private1 As Variant
Property Let Prop(newValue As Variant)
m_private1 = newValue
End Property
Property Get Prop() As Variant
Prop = m_private1 & AddClass1
End Property
Private Function AddClass1() As String
AddClass1 = "Class1"
End Function
'Class1: ----------------------------------------------

'Class2: ----------------------------------------------
Option Explicit
Implements clsClass1
Private m_obj1 As New clsClass1
Property Let clsClass1_Prop(newValue As Variant)
m_obj1.Prop = newValue
End Property
Property Get clsClass1_Prop() As Variant
clsClass1_Prop = m_obj1.Prop
End Property
Property Let Prop(newValue As Variant)
clsClass1_Prop = newValue
End Property
Property Get Prop() As Variant
Prop = Replace(m_obj1.Prop, "Class1", "Class2")
End Property
'Class2: ----------------------------------------------

'Main: ----------------------------------------------
Option Explicit
Sub Main()
Dim oBj1 As New clsClass1
Dim oBj2 As New clsClass2
oBj1.Prop = "myValue1"
Debug.Print oBj1.Prop
oBj2.Prop = "myValue2"
Debug.Print oBj2.Prop
End Sub
'Main: ----------------------------------------------
0 Likes