클래스에는 등록정보와 메소드가 포함될 수 있습니다.
Let 등록정보를 사용하면 최종 사용자가 private 클래스 변수에 값을 지정할 수 있습니다.
Get 등록정보는 읽기 전용 등록정보이며 private 클래스 변수를 검색하는 데 사용됩니다.
메소드를 사용하면 사용자가 원하는 작업을 클래스가 수행할 수 있습니다. 메소드는 함수나 서브 루틴에 불과합니다.
예:
아래 예에서는 등록정보와 메소드를 사용하여 private 변수를 래핑합니다.
Class Comp
Private modStrType
Public Property Let ComputerType(strType)
modStrType = strType
End Property
Public Property Get ComputerType
ComputerType = modStrType
End Property
Public Function Funct1
'Add business logic using class variables
End Function
Public Sub Sub1
'Add business logic using class variables
End Sub
End Class
Set objComp = new Comp
objComp.ComputerType = "Mac" 'Let Property
str1 = objComp.ComputerType 'Get Property. Here, the value of str1 is Mac
objComp.Funct1
objComp.Sub1