VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 1  'Persistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsMyObject2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' Guide to the Perplexed
' Chapter 19 examples
' Copyright (c) 1997-1998 by Desaware Inc. All Rights Reserved

Option Explicit

Private m_Numerator As Double
Private m_Denominator As Double

Public Property Get Numerator() As Double
   Numerator = m_Numerator
End Property

Public Property Let Numerator(ByVal vNewValue As Double)
   m_Numerator = vNewValue
End Property

Public Property Get Denominator() As Double
   Denominator = m_Denominator
End Property

Public Property Let Denominator(ByVal vNewValue As Double)
   If vNewValue = 0 Then Exit Property
   m_Denominator = vNewValue
End Property

Private Sub Class_Initialize()
   m_Denominator = 1
End Sub


Public Property Get Result() As Double
   Result = m_Numerator / m_Denominator
End Property


Public Property Get DisplayName() As String
   DisplayName = Str$(m_Numerator) & "/" & LTrim$(Str$(m_Denominator))
End Property

' New persistable properties

Private Sub Class_ReadProperties(PropBag As PropertyBag)
   m_Numerator = PropBag.ReadProperty("Numerator", 0)
   m_Denominator = PropBag.ReadProperty("Denominator", 1)
End Sub

Private Sub Class_WriteProperties(PropBag As PropertyBag)
   PropBag.WriteProperty "Numerator", m_Numerator, 0
   PropBag.WriteProperty "Denominator", m_Denominator, 1
End Sub
