VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsMyObject"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
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
Attribute DisplayName.VB_UserMemId = 0
   DisplayName = Str$(m_Numerator) & "/" & LTrim$(Str$(m_Denominator))
End Property

' One method to save properties
Friend Sub ReadProperties(PropBag As PropertyBag, propname$)
   m_Numerator = PropBag.ReadProperty(propname$ & "Numerator", 0)
   m_Denominator = PropBag.ReadProperty(propname$ & "Denominator", 1)
End Sub

Friend Sub WriteProperties(PropBag As PropertyBag, propname$)
   PropBag.WriteProperty propname$ & "Numerator", m_Numerator, 0
   PropBag.WriteProperty propname$ & "Denominator", m_Denominator, 1
End Sub



