Designing Class Libraries for Visual Builders by Arthur T. Jolin, David Lavin, and Susan Carpenter Example 1: (a) class IAddress : public IStandardNotifier { public: virtual IString street () const; virtual IAddress &setStreet (const IString& aStreet); static INotificationId const streetId; private: IString iStreet; } ; (b) const INotificationId IAddress::streetId = "IAddress::street"; IString IAddress::street () const { return iStreet; } IAddress& IAddress::setStreet (const IString& aStreet) { if (iStreet != aStreet) { iStreet = aStreet; IString eventData(iStreet); notifyObservers(INotificationEvent(streetId, *this, true, (void*)&eventData)); } /* endif */ return *this; } Example 2: public class Address implements java.lang.Cloneable { String fieldStreet = ""; protected transient java.beans.PropertyChangeSupport propertyChange = new java.beans.PropertyChangeSupport(this); String fieldState = ""; String fieldCity = ""; String fieldZipCode = ""; ... /* Sets the street property (java.lang.String) value. * @param street The new value for the property. * @see #getStreet */ public void setStreet(String street) { /* Get the old property value for fire property change event. */ String oldValue = fieldStreet; /* Set the street property (attribute) to the new value. */ fieldStreet = street; /* Fire (signal/notify) the street property change event. */ firePropertyChange("street", oldValue, street); return; } ... } 2