Private m_name As String
Public Function getName() As String
getName = m_name
End Function
Public Sub setName(name As String)
m_name = name
End Sub
In CreationObject module:
Public Function newClsName(name As String) As clsNameClass
Set newClsName = New clsNameClass
Call newClsName.setName(name)
End Function
Then use like:
Dim fred As clsNameClass
Set fred = newClsName("heyho")
Debug.Print (fred.getName())
with this pattern, you almost get constructors in VB.
No comments:
Post a Comment