PALAVRAS CHAVE
Boa tarde pessoal,
Estou aprendendo classes no VB, e vendo alguns exemplos, me deparei com algumas palavras que não consegui entender a sua utilização, são elas:
Implements
Friends
Option Compare Text
Alguem sabe pra que servem?
Estou aprendendo classes no VB, e vendo alguns exemplos, me deparei com algumas palavras que não consegui entender a sua utilização, são elas:
Implements
Friends
Option Compare Text
Alguem sabe pra que servem?
Consulte a Library MSDN, ou poste alguns codigos para podermos ajuda-lo melhor.
Abraços,
Abraços,
Paulo,
Segue abaixo um trecho do código:
Option Explicit
Implements CCollectionEx
Private mCol As CCollectionEx
Private Sub Class_Initialize()
Set mCol = New CCollectionEx
End Sub
Private Sub Class_Terminate()
mCol.Clear
Set mCol = Nothing
End Sub
Private Sub CCollectionEx_Add(newObj As Object, Optional Key As Variant, Optional Before As Variant, Optional After As Variant)
' Don't delete me you stupid compiler!
' We don't want to use this method.
End Sub
Private Sub CCollectionEx_Clear()
mCol.Clear
End Sub
Private Property Get CCollectionEx_Count() As Long
CCollectionEx_Count = mCol.Count
End Property
Private Property Get CCollectionEx_Item(Index As Variant) As Object
Set CCollectionEx_Item = mCol.Item(Index)
End Property
Private Function CCollectionEx_NewEnum() As stdole.IUnknown
CCollectionEx_NewEnum = mCol.NewEnum
End Function
Private Sub CCollectionEx_Remove(Index As Variant)
mCol.Remove Index
End Sub
' A rather simplied interface, just to be quick!
Public Sub Add(Color As Long, Size As Integer)
Dim Ball As CBall
Set Ball = New CBall
Ball.Color = Color
Ball.Size = Size
mCol.Add Ball
End Sub
Public Sub Clear()
mCol.Clear
End Sub
Public Property Get Item(Index As Integer) As CBall
Set Item = mCol.Item(Index)
End Property
Public Function NewEnum() As IUnknown
NewEnum = mCol.NewEnum
End Function
Já olhei o MSDN, mas não consegui entender, qual a utilidade desta palavra reservada (implements, friend).
Gostaria de uma explicação, caso você possa me ajudar.
Segue abaixo um trecho do código:
Option Explicit
Implements CCollectionEx
Private mCol As CCollectionEx
Private Sub Class_Initialize()
Set mCol = New CCollectionEx
End Sub
Private Sub Class_Terminate()
mCol.Clear
Set mCol = Nothing
End Sub
Private Sub CCollectionEx_Add(newObj As Object, Optional Key As Variant, Optional Before As Variant, Optional After As Variant)
' Don't delete me you stupid compiler!
' We don't want to use this method.
End Sub
Private Sub CCollectionEx_Clear()
mCol.Clear
End Sub
Private Property Get CCollectionEx_Count() As Long
CCollectionEx_Count = mCol.Count
End Property
Private Property Get CCollectionEx_Item(Index As Variant) As Object
Set CCollectionEx_Item = mCol.Item(Index)
End Property
Private Function CCollectionEx_NewEnum() As stdole.IUnknown
CCollectionEx_NewEnum = mCol.NewEnum
End Function
Private Sub CCollectionEx_Remove(Index As Variant)
mCol.Remove Index
End Sub
' A rather simplied interface, just to be quick!
Public Sub Add(Color As Long, Size As Integer)
Dim Ball As CBall
Set Ball = New CBall
Ball.Color = Color
Ball.Size = Size
mCol.Add Ball
End Sub
Public Sub Clear()
mCol.Clear
End Sub
Public Property Get Item(Index As Integer) As CBall
Set Item = mCol.Item(Index)
End Property
Public Function NewEnum() As IUnknown
NewEnum = mCol.NewEnum
End Function
Já olhei o MSDN, mas não consegui entender, qual a utilidade desta palavra reservada (implements, friend).
Gostaria de uma explicação, caso você possa me ajudar.
Tópico encerrado , respostas não são mais permitidas